I am using clock_gettime() & clock_settime() to get and set the QNX
clock. In QNX 4 there was a way to get and set the clock of another
node. Can I get and set the clock of another QNX6 host?
Also, are there any alternatives to the CLOCK_REALTIME?
Rennie Allen <rallen@csical.com> wrote:
RA > Bill Caroselli wrote:
Also, are there any alternatives to the CLOCK_REALTIME?
RA > Yes. There is CLOCK_MONOTONIC, which is the one and only true clock IMO.
RA > (I mean; what use is a CLOCK_POLYTONIC ?
OK. When would I choose to use on over the other?
Also, I’m still trying to get time from another system. That is my
real problem.
TIA
Bill Caroselli wrote:
Also, are there any alternatives to the CLOCK_REALTIME?
Yes. There is CLOCK_MONOTONIC, which is the one and only true clock IMO.
(I mean; what use is a CLOCK_POLYTONIC ?
Bill Caroselli <qtps@earthlink.net> wrote:
Rennie Allen <> rallen@csical.com> > wrote:
RA > Bill Caroselli wrote:
Also, are there any alternatives to the CLOCK_REALTIME?
RA > Yes. There is CLOCK_MONOTONIC, which is the one and only true clock IMO.
OK. When would I choose to use on over the other?
CLOCK_REALTIME knows when you need to know when it’s noon, or when it’s
Sunday. CLOCK_MONOTONIC does not.
CLOCK_REALTIME may slow down, speed up, or jump forwards or backwards
when someone adjusts the system time. CLOCK_MONOTONIC always runs at a
steady rate of one second per second.
From http://www.opengroup.org/onlinepubs/007904975/functions/clock_getres.html:
[…] All implementations shall support a clock_id of CLOCK_REALTIME
as defined in <time.h>. This clock represents the realtime clock
for the system. For this clock, the values returned by
clock_gettime() and specified by clock_settime() represent the
amount of time (in seconds and nanoseconds) since the Epoch.
[…] If the value of the CLOCK_REALTIME clock is set via
clock_settime(), the new value of the clock shall be used to
determine the time of expiration for absolute time services based
upon the CLOCK_REALTIME clock. This applies to the time at which
armed absolute timers expire. If the absolute time requested at the
invocation of such a time service is before the new value of the
clock, the time service shall expire immediately as if the clock had
reached the requested time normally.
[…] If the Monotonic Clock option is supported, all
implementations shall support a clock_id of CLOCK_MONOTONIC defined
in <time.h>. This clock represents the monotonic clock for the
system. For this clock, the value returned by clock_gettime()
represents the amount of time (in seconds and nanoseconds) since an
unspecified point in the past (for example, system start-up time, or
the Epoch). This point does not change after system start-up time.
The value of the CLOCK_MONOTONIC clock cannot be set via
clock_settime(). This function shall fail if it is invoked with a
clock_id argument of CLOCK_MONOTONIC.
Bill Caroselli wrote:
Also, I’m still trying to get time from another system. That is my
real problem.
Unfortunately, that is not the problem I know the answer to… Sorry.
Rennie
Thanks. I did not know that. And it is very useful.
OK. When would I choose to use on over the other?
Wojtek Lerch <wojtek_l@yahoo.ca> wrote:
WL > CLOCK_REALTIME knows when you need to know when it’s noon, or when it’s
WL > Sunday. CLOCK_MONOTONIC does not.
WL > CLOCK_REALTIME may slow down, speed up, or jump forwards or backwards
WL > when someone adjusts the system time. CLOCK_MONOTONIC always runs at a
WL > steady rate of one second per second.
WL > From http://www.opengroup.org/onlinepubs/007904975/functions/clock_getres.html:
WL > […] All implementations shall support a clock_id of CLOCK_REALTIME
WL > as defined in <time.h>. This clock represents the realtime clock
WL > for the system. For this clock, the values returned by
WL > clock_gettime() and specified by clock_settime() represent the
WL > amount of time (in seconds and nanoseconds) since the Epoch.
WL > […] If the value of the CLOCK_REALTIME clock is set via
WL > clock_settime(), the new value of the clock shall be used to
WL > determine the time of expiration for absolute time services based
WL > upon the CLOCK_REALTIME clock. This applies to the time at which
WL > armed absolute timers expire. If the absolute time requested at the
WL > invocation of such a time service is before the new value of the
WL > clock, the time service shall expire immediately as if the clock had
WL > reached the requested time normally.
WL > […] If the Monotonic Clock option is supported, all
WL > implementations shall support a clock_id of CLOCK_MONOTONIC defined
WL > in <time.h>. This clock represents the monotonic clock for the
WL > system. For this clock, the value returned by clock_gettime()
WL > represents the amount of time (in seconds and nanoseconds) since an
WL > unspecified point in the past (for example, system start-up time, or
WL > the Epoch). This point does not change after system start-up time.
WL > The value of the CLOCK_MONOTONIC clock cannot be set via
WL > clock_settime(). This function shall fail if it is invoked with a
WL > clock_id argument of CLOCK_MONOTONIC.