diff options
author | John Wiegley <johnw@newartisans.com> | 2009-10-28 01:17:54 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-10-28 01:17:54 -0400 |
commit | cc532c31aa8aa745d6d02c5c0cb22b3d75866590 (patch) | |
tree | 47eaa051abf286a08fe4406f41dacab4407ac352 /src/utils.cc | |
parent | 559566751ddd29caf2cd74c3d44982c907bd1020 (diff) | |
download | fork-ledger-cc532c31aa8aa745d6d02c5c0cb22b3d75866590.tar.gz fork-ledger-cc532c31aa8aa745d6d02c5c0cb22b3d75866590.tar.bz2 fork-ledger-cc532c31aa8aa745d6d02c5c0cb22b3d75866590.zip |
Added TRUE_CURRENT_TIME() macro
Because CURRENT_TIME() can now be a past date if --now is used.
Diffstat (limited to 'src/utils.cc')
-rw-r--r-- | src/utils.cc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/utils.cc b/src/utils.cc index 85a7aa46..a5334155 100644 --- a/src/utils.cc +++ b/src/utils.cc @@ -531,14 +531,15 @@ bool logger_func(log_level_t level) { if (! logger_has_run) { logger_has_run = true; - logger_start = CURRENT_TIME(); + logger_start = TRUE_CURRENT_TIME(); IF_VERIFY() *_log_stream << " TIME OBJSZ MEMSZ" << std::endl; } *_log_stream << std::right << std::setw(5) - << (CURRENT_TIME() - logger_start).total_milliseconds() << "ms"; + << (TRUE_CURRENT_TIME() - + logger_start).total_milliseconds() << "ms"; #if defined(VERIFY_ON) IF_VERIFY() { @@ -616,7 +617,7 @@ struct timer_t bool active; timer_t(log_level_t _level, std::string _description) - : level(_level), begin(CURRENT_TIME()), + : level(_level), begin(TRUE_CURRENT_TIME()), spent(time_duration(0, 0, 0, 0)), description(_description), active(true) {} }; @@ -637,7 +638,7 @@ void start_timer(const char * name, log_level_t lvl) timers.insert(timer_map::value_type(name, timer_t(lvl, _log_buffer.str()))); } else { assert((*i).second.description == _log_buffer.str()); - (*i).second.begin = CURRENT_TIME(); + (*i).second.begin = TRUE_CURRENT_TIME(); (*i).second.active = true; } _log_buffer.str(""); @@ -657,7 +658,7 @@ void stop_timer(const char * name) timer_map::iterator i = timers.find(name); assert(i != timers.end()); - (*i).second.spent += CURRENT_TIME() - (*i).second.begin; + (*i).second.spent += TRUE_CURRENT_TIME() - (*i).second.begin; (*i).second.active = false; #if defined(VERIFY_ON) @@ -682,7 +683,7 @@ void finish_timer(const char * name) time_duration spent = (*i).second.spent; if ((*i).second.active) { - spent = CURRENT_TIME() - (*i).second.begin; + spent = TRUE_CURRENT_TIME() - (*i).second.begin; (*i).second.active = false; } |