Using <chrono> to measure time in the LogManager

`clock()`, which was used previously, behaves differently on various platform.
So switching to this lets us use a standard part of the language which
avoids this.

Signed-off-by: B Horn <b@horn.uk>
This commit is contained in:
B Horn 2021-07-20 21:34:42 +02:00 committed by Adam Honse
parent d9de79abfe
commit a1dcf7c1cf
2 changed files with 7 additions and 7 deletions

View file

@ -27,7 +27,7 @@ struct LogMessage
unsigned int level;
const char* filename;
int line;
clock_t counted_second;
std::chrono::duration<double> counted_second;
// int timestamp or float time_offset? TBD
};
typedef std::shared_ptr<LogMessage> PLogMessage;
@ -60,7 +60,7 @@ private:
unsigned int verbosity = LL_WARNING;
//Clock from LogManager creation
clock_t base_clock;
std::chrono::time_point<std::chrono::steady_clock> base_clock;
// A non-guarded append()
void _append(const char* filename, int line, unsigned int level, const char* fmt, va_list va);