I run into a problem in Linux platform that whenever system time got changed backward, all timer stopped firing anymore. Is there anyway to get around this problem?
Hmm. The only time calls that Timer uses go via
clock_gettime (CLOCK_MONOTONIC, &t);
to get a counter, and if it works as advertised, that function is supposed to keep incrementing regardless of what you do to the system time, so this seems a bit strange. Are you sure there’s not something else going on in your app that’s causing the problem?
Many thanks for your reply. I am running this on an embedded Linux, and I am not too sure how their implementation of monotonic time will be. Maybe it is the chip specific Linux O/S implementation issue.
I had made a work around to subclass Timer and run it as a Thread and monitor whether timer is being fired. If not, I will restart the timer. This work around get me going on my application.
I will do a bit more testing on Mac platform with the most simple timer application and will get back on my testing result on Mac.
Thanks again for your help.
Thanks - we obviously can’t help much to debug what’s happening on a customised embedded platform, but if you can give us code that misbehaves on mainstream linux then we’re always happy to take a look.