qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Brad Smith <brad@comstyle.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Laurent Vivier <laurent@vivier.eu>,
	QEMU Trivial <qemu-trivial@nongnu.org>,
	Thomas Huth <thuth@redhat.com>,
	Juan Quintela <quintela@redhat.com>,
	qemu-devel@nongnu.org
Subject: Re: [PATCH] migration: Remove time_t cast for OpenBSD
Date: Sat, 13 Mar 2021 18:33:02 -0500	[thread overview]
Message-ID: <70bda12d-17fc-5e41-b723-e1409017a599@comstyle.com> (raw)
In-Reply-To: <YEpj8MsBzqfRDTWo@redhat.com>

On 3/11/2021 1:39 PM, Daniel P. Berrangé wrote:
> On Thu, Mar 11, 2021 at 06:28:57PM +0000, Dr. David Alan Gilbert wrote:
>> * Laurent Vivier (laurent@vivier.eu) wrote:
>>> Le 08/03/2021 à 12:46, Thomas Huth a écrit :
>>>> On 22/02/2021 08.28, Brad Smith wrote:
>>>>> OpenBSD has supported 64-bit time_t across all archs since 5.5 released in 2014.
>>>>>
>>>>> Remove a time_t cast that is no longer necessary.
>>>>>
>>>>>
>>>>> Signed-off-by: Brad Smith <brad@comstyle.com>
>>>>>
>>>>> diff --git a/migration/savevm.c b/migration/savevm.c
>>>>> index 52e2d72e4b..9557f85ba9 100644
>>>>> --- a/migration/savevm.c
>>>>> +++ b/migration/savevm.c
>>>>> @@ -2849,8 +2849,7 @@ bool save_snapshot(const char *name, bool overwrite, const char *vmstate,
>>>>>       if (name) {
>>>>>           pstrcpy(sn->name, sizeof(sn->name), name);
>>>>>       } else {
>>>>> -        /* cast below needed for OpenBSD where tv_sec is still 'long' */
>>>>> -        localtime_r((const time_t *)&tv.tv_sec, &tm);
>>>>> +        localtime_r(&tv.tv_sec, &tm);
>>>>>           strftime(sn->name, sizeof(sn->name), "vm-%Y%m%d%H%M%S", &tm);
>>>>>       }
>>> but the qemu_timeval from "include/sysemu/os-win32.h" still uses a long: is this file compiled for
>>> win32?
>> Yep this fails for me when built with x86_64-w64-mingw32- (it's fine
>> with i686-w64-mingw32- )
> We could just switch the code to use GDateTime from GLib and thus
> avoid portability issues. I think this should be equivalent:
>
>       g_autoptr(GDateTime) now = g_date_time_new_now_local();
>       g_autofree char *nowstr = g_date_time_format(now, "vm-%Y%m%d%H%M%s");
>       strncpy(sn->name, sizeof(sn->name), nowstr);

Which way do you guys want to go? Something like above, remove the comment
or some variation on the comment but not mentioning OpenBSD since it is no
longer relevant?


  reply	other threads:[~2021-03-13 23:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-22  7:28 [PATCH] migration: Remove time_t cast for OpenBSD Brad Smith
2021-03-08 11:46 ` Thomas Huth
2021-03-09 21:08   ` Laurent Vivier
2021-03-11 18:28     ` Dr. David Alan Gilbert
2021-03-11 18:39       ` Daniel P. Berrangé
2021-03-13 23:33         ` Brad Smith [this message]
2021-03-31 19:26           ` Brad Smith
2021-04-01  8:14             ` Daniel P. Berrangé
2021-04-01 17:14               ` Brad Smith
2021-03-09 21:38   ` Brad Smith

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=70bda12d-17fc-5e41-b723-e1409017a599@comstyle.com \
    --to=brad@comstyle.com \
    --cc=berrange@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=laurent@vivier.eu \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).