qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 19/20] w64: Fix time conversion for some version


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 19/20] w64: Fix time conversion for some versions of MinGW-w64
Date: Mon, 16 Apr 2012 14:49:06 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120329 Thunderbird/11.0.1

On 04/15/2012 08:13 AM, Stefan Weil wrote:
> tb.time is a time value, but not necessarily of the same size as time_t:
> while time_t is 64 bit for w64, tb.time still is 32 bit only.

That's a POSIX compliance bug, but one that mingw64 inherited from
Microsoft :(

https://lists.gnu.org/archive/html/bug-gnulib/2012-01/msg00352.html

> 
> Therefore we need en explicit conversion.

Unfortunately true.

> 
> Signed-off-by: Stefan Weil <address@hidden>
> ---
>  savevm.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/savevm.c b/savevm.c
> index 12fb209..2d18bab 100644
> --- a/savevm.c
> +++ b/savevm.c
> @@ -2106,7 +2106,8 @@ void do_savevm(Monitor *mon, const QDict *qdict)
>          }
>      } else {
>  #ifdef _WIN32
> -        ptm = localtime(&tb.time);
> +        time_t t = tb.time;
> +        ptm = localtime(&t);
>          strftime(sn->name, sizeof(sn->name), "vm-%Y%m%d%H%M%S", ptm);
>  #else
>          /* cast below needed for OpenBSD where tv_sec is still 'long' */

-- 
Eric Blake   address@hidden    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]