From 8df1123044f6db7e7fb1b3981cd77750cb1ebb43 Mon Sep 17 00:00:00 2001 From: Alex Schmidt Date: Tue, 21 Aug 2012 13:33:09 +0200 Subject: [PATCH] ... --- writeout.cpp | 13 +++++++------ writeout.h | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/writeout.cpp b/writeout.cpp index eb14309..73adfa6 100644 --- a/writeout.cpp +++ b/writeout.cpp @@ -12,20 +12,21 @@ using namespace std; -string writeout::tstamp() +string writeout::tstamp(const long& timestamp) { - stringstream sstr; - sstr << time (NULL); - return sstr.str(); + stringstream sstr; + if(!timestamp) sstr << time (NULL); + else sstr << timestamp; + return sstr.str(); } writeout::writeout(const string& wdir, const string& signature, - const int& rank, const int& procs) + const int& rank, const int& procs, const long& timestamp) { if(wdir != ""){ numprocs = procs; sprintf(cRank, "%d", rank); - fulldir = wdir + "/" + tstamp() + "_" + signature; + fulldir = wdir + "/" + tstamp(timestamp) + "_" + signature; mkdir( fulldir.c_str(), 0775); if(rank>0) of.open( (fulldir + "/rank" + cRank + ".tmp").c_str() ); diff --git a/writeout.h b/writeout.h index 48057d4..4df290d 100644 --- a/writeout.h +++ b/writeout.h @@ -10,7 +10,7 @@ class writeout { public: writeout(const string& wdir, const string& signature, - const int& rank, const int& procs); + const int& rank, const int& procs, const long& timestamp=0); ostream *out; ~writeout(); @@ -19,7 +19,7 @@ class writeout streambuf *buf; string fulldir; char cRank[20]; - string tstamp(); + string tstamp(const long& timestamp); int numprocs; string getdatfile(); }; -- 2.39.5