Changeset 1707


Ignore:
Timestamp:
Apr 20, 2010 9:52:51 PM (12 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.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/lang/tcl/scripts/result.tcl

    r1018 r1707  
    4848    }
    4949
    50     set oname "run[clock seconds].xml"
     50    # fake milliseconds by using clock clicks
     51    # fake microseconds by using 000
     52    # this will be fixed when tcl uses C bindings
     53    set timestamp [format %d%03d%03d [clock seconds] [expr [clock clicks -milliseconds]%1000] 0]
     54    set oname "run$timestamp.xml"
    5155    set fid [open $oname w]
    5256    puts $fid "<?xml version=\"1.0\"?>"
  • 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.