[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 2/3] libxl: ocaml: use int64 for timeval fields in the timeout_register callback



Ian Jackson wrote:
> Rob Hoes writes ("RE: [PATCH 2/3] libxl: ocaml: use int64 for timeval
> fields in the timeout_register callback"):
> > Ian Jackson wrote:
> > > If it would help I would be happy to have libxl promise never to use
> > > such absurdly long timeouts.
> >
> > This was because the absolute time is given to timeout_register, and the
> tv_sec field of the timeval that comes out of gettimeofday() is just a
> little too large for a 31-bit signed integer...
> 
> Oh, right.
> 
> > I didn't see this before, because I was testing on a 64-bit box. When I
> moved to our 32-bit dom0, it started overflowing.
> 
> I had forgotten that the timeout registration presents an absolute timeval.
> 
> Does ocaml not have a more natural format for a timeval than two int64's ?
> 
> (The tv_nsec field is guaranteed to be < 1E9 so fits in 30 bits...)

The OCaml Unix.gettimeofday function returns a number of type "float", which in 
OCaml is a 64-bit number. This may be an alternative.

I just thought it would be best to stay as close as possible to the C 
implementation in the bindings, and return the two separate numbers that we are 
given.

Rob

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.