[libvirt] [PATCH] Fix off-by-one printing month in logging code

From: "Daniel P. Berrange" <berrange@redhat.com> 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 --- src/util/logging.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/src/util/logging.c b/src/util/logging.c index 9df9003..17c7e84 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, -- 1.7.6.4

On 10/24/2011 10:35 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange"<berrange@redhat.com>
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 --- src/util/logging.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
ACK. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
participants (2)
-
Daniel P. Berrange
-
Eric Blake