summaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorStefan Weil <sw@weilnetz.de>2013-01-07 23:08:13 +0100
committerStefan Hajnoczi <stefanha@redhat.com>2013-01-11 09:44:37 +0100
commiteb7ff6fb0bddb33991fa44586ac8e2e02019dc97 (patch)
tree0a6fcfc7520909bc0ec7e74ec1921c402076c7b2 /vl.c
parent68b891ec3937aa2e18eed5a403b1d9fd9b875084 (diff)
downloadqemu-eb7ff6fb0bddb33991fa44586ac8e2e02019dc97.tar.gz
qemu-eb7ff6fb0bddb33991fa44586ac8e2e02019dc97.tar.bz2
qemu-eb7ff6fb0bddb33991fa44586ac8e2e02019dc97.zip
Replace remaining gmtime, localtime by gmtime_r, localtime_r
This allows removing of MinGW specific code and improves reentrancy for POSIX hosts. [Removed unused ret variable in qemu_get_timedate() to fix warning: vl.c: In function ‘qemu_get_timedate’: vl.c:451:16: error: variable ‘ret’ set but not used [-Werror=unused-but-set-variable] -- Stefan Hajnoczi] Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/vl.c b/vl.c
index f056c95807..aed4182ae8 100644
--- a/vl.c
+++ b/vl.c
@@ -448,21 +448,18 @@ StatusInfo *qmp_query_status(Error **errp)
void qemu_get_timedate(struct tm *tm, int offset)
{
time_t ti;
- struct tm *ret;
time(&ti);
ti += offset;
if (rtc_date_offset == -1) {
if (rtc_utc)
- ret = gmtime(&ti);
+ gmtime_r(&ti, tm);
else
- ret = localtime(&ti);
+ localtime_r(&ti, tm);
} else {
ti -= rtc_date_offset;
- ret = gmtime(&ti);
+ gmtime_r(&ti, tm);
}
-
- memcpy(tm, ret, sizeof(struct tm));
}
int qemu_timedate_diff(struct tm *tm)