[zeromq-dev] Monotonic clock ?

julien tayon julien at tayon.net
Tue Oct 1 21:16:47 CEST 2013


First Point
https://github.com/zeromq/libzmq/blob/master/src/clock.cpp#L75
Here I see you use monotonic clock
But according to the man clock_gettime
I read :
       CLOCK_MONOTONIC
              Clock that cannot be set and represents monotonic time since
some unspecified starting point.

       CLOCK_MONOTONIC_RAW (since Linux 2.6.28; Linux-specific)
              Similar to CLOCK_MONOTONIC, but provides access to a raw
hardware-based time that is not subject to NTP adjustments.


Wouldn't it be possible that for linux you may have a bug that will appear
during ntp adujstements?
(PS I have a hard time to get a definition of in how CLOCK_MONOTONIC is
affected on linux by NTP, it seems that they play with frequencies to
adjust CLOCK_MONOTONIC thus clock monotonic is indeed monotonic but not a
reliable source of comparable absolute time interval. )


Second Point:
according to a lot a redirection the type for seconds in _time_t is on
linux
struct timespec
  {
    __time_t tv_sec;            /* Seconds.  */
    long int tv_nsec;           /* Nanoseconds.  */
  };

with according to the other headers :
__STD_TYPE __TIME_T_TYPE __time_t;      /* Seconds since the Epoch.  */
and
#define __TIME_T_TYPE           __SLONGWORD_TYPE
thus __time_t is SLONGWORD


https://github.com/zeromq/libzmq/blob/master/src/clock.cpp#L84
the cast is made on uint64
I guess SLONGWORD => Signed long word
uint64 seems to be an unsigned.

I was wondering if by any chance there is a wrong casting ... that could
cause a bug in a mlillenium or two.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20131001/157ec6c5/attachment.htm>


More information about the zeromq-dev mailing list