mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
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>
This commit is contained in:
parent
68b891ec39
commit
eb7ff6fb0b
4 changed files with 4 additions and 21 deletions
9
vl.c
9
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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue