Revision eb7ff6fb
b/block.c | ||
---|---|---|
3338 | 3338 |
char *bdrv_snapshot_dump(char *buf, int buf_size, QEMUSnapshotInfo *sn) |
3339 | 3339 |
{ |
3340 | 3340 |
char buf1[128], date_buf[128], clock_buf[128]; |
3341 |
#ifdef _WIN32 |
|
3342 |
struct tm *ptm; |
|
3343 |
#else |
|
3344 | 3341 |
struct tm tm; |
3345 |
#endif |
|
3346 | 3342 |
time_t ti; |
3347 | 3343 |
int64_t secs; |
3348 | 3344 |
|
... | ... | |
3352 | 3348 |
"ID", "TAG", "VM SIZE", "DATE", "VM CLOCK"); |
3353 | 3349 |
} else { |
3354 | 3350 |
ti = sn->date_sec; |
3355 |
#ifdef _WIN32 |
|
3356 |
ptm = localtime(&ti); |
|
3357 |
strftime(date_buf, sizeof(date_buf), |
|
3358 |
"%Y-%m-%d %H:%M:%S", ptm); |
|
3359 |
#else |
|
3360 | 3351 |
localtime_r(&ti, &tm); |
3361 | 3352 |
strftime(date_buf, sizeof(date_buf), |
3362 | 3353 |
"%Y-%m-%d %H:%M:%S", &tm); |
3363 |
#endif |
|
3364 | 3354 |
secs = sn->vm_clock_nsec / 1000000000; |
3365 | 3355 |
snprintf(clock_buf, sizeof(clock_buf), |
3366 | 3356 |
"%02d:%02d:%02d.%03d", |
b/block/vvfat.c | ||
---|---|---|
529 | 529 |
/* if return_time==0, this returns the fat_date, else the fat_time */ |
530 | 530 |
static uint16_t fat_datetime(time_t time,int return_time) { |
531 | 531 |
struct tm* t; |
532 |
#ifdef _WIN32 |
|
533 |
t=localtime(&time); /* this is not thread safe */ |
|
534 |
#else |
|
535 | 532 |
struct tm t1; |
536 | 533 |
t = &t1; |
537 | 534 |
localtime_r(&time,t); |
538 |
#endif |
|
539 | 535 |
if(return_time) |
540 | 536 |
return cpu_to_le16((t->tm_sec/2)|(t->tm_min<<5)|(t->tm_hour<<11)); |
541 | 537 |
return cpu_to_le16((t->tm_mday)|((t->tm_mon+1)<<5)|((t->tm_year-80)<<9)); |
b/hw/omap1.c | ||
---|---|---|
2830 | 2830 |
s->round = 0; |
2831 | 2831 |
} |
2832 | 2832 |
|
2833 |
memcpy(&s->current_tm, localtime(&s->ti), sizeof(s->current_tm));
|
|
2833 |
localtime_r(&s->ti, &s->current_tm);
|
|
2834 | 2834 |
|
2835 | 2835 |
if ((s->interrupts & 0x08) && s->ti == s->alarm_ti) { |
2836 | 2836 |
s->status |= 0x40; |
b/vl.c | ||
---|---|---|
448 | 448 |
void qemu_get_timedate(struct tm *tm, int offset) |
449 | 449 |
{ |
450 | 450 |
time_t ti; |
451 |
struct tm *ret; |
|
452 | 451 |
|
453 | 452 |
time(&ti); |
454 | 453 |
ti += offset; |
455 | 454 |
if (rtc_date_offset == -1) { |
456 | 455 |
if (rtc_utc) |
457 |
ret = gmtime(&ti);
|
|
456 |
gmtime_r(&ti, tm);
|
|
458 | 457 |
else |
459 |
ret = localtime(&ti);
|
|
458 |
localtime_r(&ti, tm);
|
|
460 | 459 |
} else { |
461 | 460 |
ti -= rtc_date_offset; |
462 |
ret = gmtime(&ti);
|
|
461 |
gmtime_r(&ti, tm);
|
|
463 | 462 |
} |
464 |
|
|
465 |
memcpy(tm, ret, sizeof(struct tm)); |
|
466 | 463 |
} |
467 | 464 |
|
468 | 465 |
int qemu_timedate_diff(struct tm *tm) |
Also available in: Unified diff