32 bit overflow in timer

Bob Stewart robjsstewart at ...9...
Sun Feb 18 20:59:20 CET 2018


Johannes,

Unsigned longs are 4 bytes. Unsigned long longs are 8 bytes. One byte equals 8 bits.

Bob Stewart


Get Outlook for Android<https://aka.ms/ghei36>

________________________________
From: Johannes Kliemann <kliemann at ...543...>
Sent: Sunday, February 18, 2018 6:01:36 AM
To: Genode OS Framework Mailing List
Subject: 32 bit overflow in timer

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

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
genode-main mailing list
genode-main at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/genode-main
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.genode.org/pipermail/users/attachments/20180218/c68e1c5f/attachment.html>


More information about the users mailing list