[Openais] changing gettimeofday to times
Patrick Caulfield
pcaulfie at redhat.com
Tue Nov 14 03:15:41 PST 2006
Steven Dake wrote:
> If the system time is changed while openais is running the timing system
> gets all out of wack. This is because gettimeofday returns the current
> time, instead of the number of msec since boot and is used in the tlist
> code.
>
> There is a mechanism to determine the number of msec since boot which
> appears to be portable. The posix API is "times" which returns the
> number of clock ticks since system boot.
>
> The Linux man page says times returns a time value from some time in the
> past but on linux this is the system boot time.
>
> On BSD or Solaris, is this also the case? I don't have the man pages to
> check these systems and would like a portable solution. The other
> possibility is getitimer and setitimer or the posix timer_gettime
> absolute time but I think these posix APIs are not supported on all
> platforms.
>From the Darwin man page for times()
This interface is obsoleted by getrusage(2) and gettimeofday(2).
The times() function returns the value of time in CLK_TCK's of a second
since 0 hours, 0 minutes, 0 seconds, January 1, 1970, Coordinated Univer-
sal Time.
--
patrick
More information about the Openais
mailing list