Stored dates are no more 1970-01-01 (+ run time), but have a real meaning.
If someone wants to have comparable timestamps accross boots, it is
possible to start qemu with -rtc to give the startup date.
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
typedef struct DumpState {
VLANClientState nc;
+ int64_t start_ts;
int fd;
int pcap_caplen;
} DumpState;
ts = muldiv64(qemu_get_clock_ns(vm_clock), 1000000, get_ticks_per_sec());
caplen = size > s->pcap_caplen ? s->pcap_caplen : size;
- hdr.ts.tv_sec = ts / 1000000;
+ hdr.ts.tv_sec = ts / 1000000 + s->start_ts;
hdr.ts.tv_usec = ts % 1000000;
hdr.caplen = caplen;
hdr.len = size;
struct pcap_file_hdr hdr;
VLANClientState *nc;
DumpState *s;
+ struct tm tm;
int fd;
fd = open(filename, O_CREAT | O_TRUNC | O_WRONLY | O_BINARY, 0644);
s->fd = fd;
s->pcap_caplen = len;
+ qemu_get_timedate(&tm, 0);
+ s->start_ts = mktime(&tm);
+
return 0;
}