Am 06.01.2012 08:37, schrieb Zhang, Yang Z: > use int64 when compare two time > > int32 only represent only 136 years when comparing two times based on second. > It would be better to use int64.
int32 and int64 are softfloat types and should not be used here. Do you have an actual use case that breaks with int / int32_t? > > Signed-off-by: Yang Zhang <yang.z.zh...@intel.com> > diff --git a/vl.c b/vl.c > index 640e3ca..01c5a9d 100644 > --- a/vl.c > +++ b/vl.c > @@ -454,7 +454,7 @@ void qemu_get_timedate(struct tm *tm, int offset) > memcpy(tm, ret, sizeof(struct tm)); > } > > -int qemu_timedate_diff(struct tm *tm) > +int64_t qemu_timedate_diff(struct tm *tm) > { > time_t seconds; > > @@ -476,7 +476,7 @@ void rtc_change_mon_event(struct tm *tm) > { > QObject *data; > > - data = qobject_from_jsonf("{ 'offset': %d }", qemu_timedate_diff(tm)); > + data = qobject_from_jsonf("{ 'offset': %ld }", qemu_timedate_diff(tm)); That's wrong, %ld is for long. For int64_t you need to use PRId64. Andreas > monitor_protocol_event(QEVENT_RTC_CHANGE, data); > qobject_decref(data); > } -- SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg