From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?ISO-8859-1?Q?Andreas_F=E4rber?= Subject: Re: [PATCH 1/3]use int64 when compare two time Date: Fri, 06 Jan 2012 18:44:06 +0100 Message-ID: <4F0732E6.6000707@suse.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: "aliguori@us.ibm.com" , "Shan, Haitao" , "qemu-devel@nongnu.org" , "kvm@vger.kernel.org" , "avi@redhat.com" To: "Zhang, Yang Z" Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org Sender: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org List-Id: kvm.vger.kernel.org Am 06.01.2012 08:37, schrieb Zhang, Yang Z: > use int64 when compare two time >=20 > int32 only represent only 136 years when comparing two times based on s= econd. 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? >=20 > Signed-off-by: Yang Zhang > 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)); > } >=20 > -int qemu_timedate_diff(struct tm *tm) > +int64_t qemu_timedate_diff(struct tm *tm) > { > time_t seconds; >=20 > @@ -476,7 +476,7 @@ void rtc_change_mon_event(struct tm *tm) > { > QObject *data; >=20 > - data =3D qobject_from_jsonf("{ 'offset': %d }", qemu_timedate_diff= (tm)); > + data =3D qobject_from_jsonf("{ 'offset': %ld }", qemu_timedate_dif= f(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); > } --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg