On Wed, Apr 21, 2010 at 11:48:30AM +0530, [email protected] wrote:
> I have a query related to gethrtime() and gettimeofday() system calls.
> Is there any relation between them?
> if given the hrtime can we get the system time and vice-versa in Solaris10.
There is no relation between the two functions. The description of
gethrtime(2) in the manpage is accurate:
DESCRIPTION
The gethrtime() function returns the current
high-resolution real time. Time is expressed as nanoseconds
since some arbitrary time in the past; it is not correlated
in any way to the time of day, and thus is not subject to
resetting or drifting by way of adjtime(2) or
settimeofday(3C). The hi-res timer is ideally suited to
performance measurement tasks, where cheap, accurate
interval timing is required.
[...]
NOTES
Although the units of hi-res time are always the same
(nanoseconds), the actual resolution is hardware dependent.
Hi-res time is guaranteed to be monotonic (it won't go
backward, it won't periodically wrap) and linear (it won't
occasionally speed up or slow down for adjustment, like the
time of day can), but not necessarily unique: two
sufficiently proximate calls may return the same value.
-j
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code