From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:35229) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TtaFm-0000HX-FT for qemu-devel@nongnu.org; Fri, 11 Jan 2013 03:46:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TtaFk-000533-4x for qemu-devel@nongnu.org; Fri, 11 Jan 2013 03:46:18 -0500 Date: Fri, 11 Jan 2013 09:46:04 +0100 From: Stefan Hajnoczi Message-ID: <20130111084604.GE23656@stefanha-thinkpad.muc.redhat.com> References: <1357596493-27396-1-git-send-email-sw@weilnetz.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1357596493-27396-1-git-send-email-sw@weilnetz.de> Subject: Re: [Qemu-devel] [Qemu-trivial] [PATCH] Replace remaining gmtime, localtime by gmtime_r, localtime_r List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Weil Cc: Kevin Wolf , Peter Maydell , Anthony Liguori , qemu-trivial@nongnu.org, qemu-devel@nongnu.org, Stefan Hajnoczi 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