XtAppAddTimeout and clock skew

70 Views Asked by At

My company produces linux-based embedded systems. For hardware testing purposes, we are using a program based on Xt toolkit. It works fine, except that the initial system date is wrong, and is adjusted only later by NTP in the startup procedure. This confuses the Xt library, that defines some timeouts by XtAppAddTimeout. It looks like Xt doesn't manage the clock skew correctly, in particular if the actual date is far in the past. For many reasons, I can't change the testing environment nor the application (except for small local changes, as I eventually did).

I quickly solved the problem by adding a thread that generates "clock ticks" by sending a character to the write side of a local pipe, and intercepting the events at the read side by registering a callback via XtAppAddInput. The application works, but I'd prefer a simpler solution. It would be nice if Xt used a monotonic clock, but it doesn't (or,if it does, I don't know how to enable it). I also considered to "fake" the API by intercepting gettimeofday, select, poll etc by dynamic link tricks, but it does not seem that simple, although possible in principle. So, are there known (simpler the mine) workarounds for this problem?

0

There are 0 best solutions below