30 gettimeofday(&tv_start_, NULL);
48 gettimeofday(&t, NULL);
49 return ((t.tv_sec - tv_start_.tv_sec)) + ((t.tv_usec - tv_start_.tv_usec) / 1000000.0);
57 gettimeofday(&t, NULL);
58 return (t.tv_sec) + (t.tv_usec / 1000000.0);
65 std::time_t t = std::time(
nullptr);
67 if (std::strftime(mbstr,
sizeof(mbstr),
"%A %c", std::localtime(&t))) {
82 timeinfo = localtime(&rawtime);
83 strftime(buffer,
sizeof(buffer), (
const char*)
"%Y-%m-%d_%a_%H-%M-%S", timeinfo);
Singleton which manages wall-clock time for simulations in SPARTA This is not a "timer" manager,...
double getAbsoluteSeconds() const
Gets the absolute second timestamp for this machine.
std::string getTimestamp() const
Returns a unix timestamp string.
TimeManager()
Default constructor.
std::string getSortableLocalTime() const
Returns a string representing local time in a format suitable for trival string sorting.
double getSecondsElapsed() const
Gets the number of seconds elapsed since the instantiation of SPARTA static and global vars.
std::string getLocalTime() const
Returns a string representing local time for the simulator.
static TimeManager & getTimeManager()
Returns the TimeManager singleton.
Macros for handling exponential backoff.