From: Daniel P. Berrange Date: Mon, 24 Oct 2011 16:33:00 +0000 (+0100) Subject: Fix off-by-one printing month in logging code X-Git-Tag: v0.9.7~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=26b74307736f3723556c11a6c157530399782bc3;p=thirdparty%2Flibvirt.git 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 --- diff --git a/src/util/logging.c b/src/util/logging.c index 9df90030ab..17c7e84385 100644 --- a/src/util/logging.c +++ b/src/util/logging.c @@ -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,