32 bit overflow in timer

Johannes Kliemann kliemann at ...543...
Sun Feb 18 12:01:36 CET 2018


Hi all,

I noticed a 32 bit overflow in the Timer::Connection sleep functions and
triggers.
Calling usleep or trigger_once with an hour (3 600 000 000 us) works but
calling it with two hours (7 200 000 000 us) causes something to
overflow and stop the timer after 2 905 032 704 us which equals 7 200
000 000 & (2^32 - 1).

As far as I have checked this these functions use the unsigned long
which is indeed 64 bit but I think at some point only 32 bit are used.

Is this intended behaviour?
If so I think it would make sense to give out a warning at least.

Regards,
Johannes




More information about the users mailing list