Issues with clock_gettime(CLOCK_REALTIME, &wait) pre macOS 10.13
Chris Jones
jonesc at hep.phy.cam.ac.uk
Tue Oct 23 16:29:31 UTC 2018
>>
>> BTW, here is a nice clock_gettime() replacement that Jeremy wrote up:
>>
>> <https://github.com/macports/macports-ports/blob/master/graphics/cogl/files/patch-clock_gettime.diff>
>>
>
>
> Thanks. That is a bit better than what I cooked up for xrootd. I might
> replace it ;)
Actually, I take that back. I am not convinced the implementation in the
above link is giving results consistent with the method it is supposed
to be provide. See the attached example test code...
test1 is the output from clock_gettime(CLOCK_REALTIME, &ts);, whether
that be from the system ( 10.12+) or from the link above (older).
test2 is my own workaround.
One 10.12 I get
> ./mac1013.exe
time1 1540311943653502000
time2 1540311943653580000
time1 1540311943653606000
time2 1540311943653619000
so the two give the same times (note time of course moves on between
each call, but the two clearly agree).
on 10.9 though I get
> ./mac109.exe
time1 1156992536990
time2 1540311478974454000
time1 1156992628574
time2 1540311478974495000
see how the values of time2 agree, but time1 (now from Jeremy's
implementation) clearly has a completely different scale.
Not sure why, but for sure its not quite a drop in replacement...
Chris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: time.cpp
Type: text/x-c++src
Size: 1829 bytes
Desc: not available
URL: <http://lists.macports.org/pipermail/macports-dev/attachments/20181023/1b6cc4b5/attachment.cpp>
More information about the macports-dev
mailing list