> From: Paolo Bonzini [mailto:pbonz...@redhat.com] > On 22/01/2015 09:52, Pavel Dovgalyuk wrote: > > This patch introduces functions for recording and replaying realtime > > sources, > > that do not use qemu-clock interface. These include return value of time() > > function in time_t and struct tm forms. Patch also adds warning to > > get_timedate function to prevent its usage in recording mode, because it may > > lead to non-determinism. > > > > Signed-off-by: Pavel Dovgalyuk <pavel.dovga...@ispras.ru> > > --- > > hw/timer/mc146818rtc.c | 3 + > > hw/timer/pl031.c | 3 + > > include/qemu-common.h | 1 > > replay/replay-internal.h | 4 + > > replay/replay-time.c | 132 > > ++++++++++++++++++++++++++++++++++++++++++++++ > > replay/replay.h | 8 +++ > > vl.c | 17 +++++- > > 7 files changed, 163 insertions(+), 5 deletions(-) > > > > diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c > > index f18d128..92295fb 100644 > > --- a/hw/timer/mc146818rtc.c > > +++ b/hw/timer/mc146818rtc.c > > @@ -28,6 +28,7 @@ > > #include "qapi/visitor.h" > > #include "qapi-event.h" > > #include "qmp-commands.h" > > +#include "replay/replay.h" > > > > #ifdef TARGET_I386 > > #include "hw/i386/apic.h" > > @@ -703,7 +704,7 @@ static void rtc_set_date_from_host(ISADevice *dev) > > RTCState *s = MC146818_RTC(dev); > > struct tm tm; > > > > - qemu_get_timedate(&tm, 0); > > What about just making qemu_get_timedate use > qemu_clock_get_ns(QEMU_CLOCK_HOST) instead of time()? This would just > work using the infrastructure of the previous patch.
I can get rid of these calls, but localtime() function used in qemu_get_timedate() will not work deterministically. Should we save its' result then? Pavel Dovgalyuk