Changeset 1707 for trunk/src/core


Ignore:
Timestamp:
Apr 20, 2010 9:52:51 PM (14 years ago)
Author:
dkearney
Message:

adding temp fix for how we format filenames. the changes will provide more unique filenames down to near millisecond resolution of time for semi-POSIX compliant systems. I needed this fix in particular for workflow stuff i am playing with.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/RpLibrary.cc

    r1527 r1707  
    2727#include <iterator>
    2828#include <cctype>
     29
     30#ifdef _POSIX_SOURCE
     31    #include <sys/time.h>
     32#endif /* _POSIX_SOURCE */
    2933
    3034// no arg constructor
     
    22002204
    22012205    if (this->root) {
     2206#ifdef _POSIX_SOURCE
     2207        // if the posix function gettimeofday is available,
     2208        // we can get more precision on the time and more
     2209        // unique filenames.
     2210        struct timeval tv;
     2211        gettimeofday(&tv,NULL);
     2212        outputFile << "run" << tv.tv_sec << tv.tv_usec << ".xml";
     2213#else
    22022214        outputFile << "run" << (int)time(&t) << ".xml";
     2215#endif
    22032216        file.open(outputFile.str().c_str(),std::ios::out);
    22042217
Note: See TracChangeset for help on using the changeset viewer.