Fix off-by-one printing month in logging code

The field 'mon' in 'struct tm' gives months 0-11, where as
humans tend to expect months 1-12. Thus the month number
needing adjusting by 1

* src/util/logging.c: Use human friendly month number
This commit is contained in:
Daniel P. Berrange 2011-10-24 17:33:00 +01:00
parent f4786c1885
commit 26b7430773

View File

@ -628,6 +628,7 @@ virLogFormatTimestamp(void)
gettimeofday(&cur_time, NULL);
localtime_r(&cur_time.tv_sec, &time_info);
time_info.tm_year += 1900;
time_info.tm_mon += 1;
if (virAsprintf(&str, "%4d-%02d-%02d %02d:%02d:%02d.%03d",
time_info.tm_year, time_info.tm_mon, time_info.tm_mday,