Can't create timers longer than ~71 minutes

Felix Friedlander felix.friedlander at anu.edu.au
Wed Aug 21 11:55:07 CEST 2024


I encountered this issue when setting up the mrt protocol to 
periodically dump routing tables. Despite specifying "period 28800", 
which should log every 28,800 seconds = 8 hours, dumps were being saved 
every 50-ish minutes.

It appears this is because timers (defined in lib/timer.h) currently 
store their interval ("recurrent") in microseconds as a uint - on most 
platforms, a 32-bit integer. Naturally, 28,800,000,000 µs taken mod 2^32 
gives 3,030,196,224 µs, or ~50.5 minutes.

As far as I can tell, this means bird's timers (on 32-bit and LP64 
platforms) can't wait any longer than 2^32 µs, or ~71.6 minutes. I 
imagine for many uses this is fine, but for scheduling periodic events, 
it's not ideal - exporting or syncing some data a handful of times a day 
(or less!) seems like a sensible thing to want to do.

Increasing this to 64 bits seems easy enough - does someone know 
otherwise? Or have a better idea?

Thanks,
- Felix


More information about the Bird-users mailing list