[nos-bbs] Update - Timer issues in JNOS

Maiko Langelaar maiko at pcs.mb.ca
Wed Aug 4 12:51:11 EDT 2010

I'm just posting this in case anyone is interested or sees
a flaw with the approach I'm using.

After thinking about this a bit more, I've concluded that perhaps
there is a much better, much easier way to do this, and one which
involves minimal code changes.

Changing to unsigned only fixes the problem for another 25 days, after
a period of 52 days or so, the negative timer problem will resurface,
since going from signed to unsigned only doubles the maximum value.

Moving to a long will fix this on x86_64 systems, but not on  i386 systems,
since long and int are same size on those systems. I could really minimize
the code changes by instead keeping the original code, and just resetting the
NOS start time every 20 days, and create a '20 day counter' that will get
bumped up every 20 days. Minimal code changes, and it will work as long 
as the 20 day counter never overflows (which it won't). The counter in
conjunction with the start time can easily tell us the 'uptime'.

I've already checked and if I start changing stuff from signed to unsigned
or whatever, there is more code changes than I really care to make.

Any comments ?


More information about the nos-bbs mailing list