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() );
{
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();
streambuf *buf;
string fulldir;
char cRank[20];
- string tstamp();
+ string tstamp(const long& timestamp);
int numprocs;
string getdatfile();
};