[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-trivial] [PATCH] Replace remaining gmtime, localtime by gmtime
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-trivial] [PATCH] Replace remaining gmtime, localtime by gmtime_r, localtime_r |
Date: |
Fri, 11 Jan 2013 09:46:04 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Mon, Jan 07, 2013 at 11:08:13PM +0100, Stefan Weil wrote:
> diff --git a/vl.c b/vl.c
> index f056c95..21e4a74 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -454,15 +454,13 @@ void qemu_get_timedate(struct tm *tm, int offset)
> ti += offset;
> if (rtc_date_offset == -1) {
> if (rtc_utc)
> - ret = gmtime(&ti);
> + ret = gmtime_r(&ti, tm);
> else
> - ret = localtime(&ti);
> + ret = localtime_r(&ti, tm);
> } else {
> ti -= rtc_date_offset;
> - ret = gmtime(&ti);
> + ret = gmtime_r(&ti, tm);
> }
> -
> - memcpy(tm, ret, sizeof(struct tm));
> }
BTW I fixed the compiler warning here, no need to respin:
vl.c: In function ‘qemu_get_timedate’:
vl.c:451:16: error: variable ‘ret’ set but not used
[-Werror=unused-but-set-variable]
Stefan