-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dest.c: Use monotonic time for cups_enum_dest #1084
base: 2.4.x
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking we need a CUPS API that returns a monotonic value, probably a double for portability.
double cupsGetClock(void);
If we back-port this to CUPS 2.4.x, we'll want to leave this as private API (_cupsGetClock
).
[master 0350eba] Add cupsGetClock API. Also in libcups repository. |
3256ace
to
8e7e192
Compare
8e7e192
to
43e3319
Compare
@michaelrsweet hmm, looks like Mac monotonic clock precision is buggy... I've looked into Mac results on current master branch and there is something wrong with MacOS test suite - I see fail for cupsGetClock(), but the CI run shows as passed:
I will try the CLOCK_MONOTONIC_RAW, if it helps MacOS... |
To no avail... here is the post I found about Mac and CLOCK_MONOTONIC https://discussions.apple.com/thread/253778121?page=2&sortBy=rank . |
The CI failure might be cause by load on the system or virtualization speed - the testclock program is just seeing that the monotonic clock is increasing and roughly close to the expected (wall) clock time. Having jitter that large isn't ideal but as long as the values are increasing it won't cause a problem. |
@michaelrsweet so I would ifdef the test binary and raise acceptable delta for Mac? Or introduce a new function which will allow us to set acceptable delta and use that with a different value on Mac? |
This is just in the unit test program, so we can increase the acceptable delta (say to 1 second) or just drop it to avoid future woe. The key is to flag values going backwards. |
Patch written by Adam Williamson.
gettimeofday()
is vulnerable to clock jumps, so it is better to useclock_gettime()
to avoid issues with libcups if system changes clock, f.e. in Live CDs.