[nos-bbs] Update - Timer issues in JNOS

Bill Smith hbco2 at sbcglobal.net
Tue Aug 3 15:26:51 EDT 2010


----- Original Message ----- 
From: Maiko Langelaar
To: TAPR xNOS Mailing List
Sent: Tuesday, August 03, 2010 10:45 AM
Subject: [nos-bbs] Update - Timer issues in JNOS


Good day,

The msclock() function returns a signed integer, which we know to
have an upper limit of 2 147 483 647. With some debugging info, and
some calculations, it would appear that msclock() will return a value
of 2 178 000 000 after roughly 25 days - exceeding the upper limit.

In unix.c - ding() - calculation of clock results in this :

    24 days - clock 38016000
    25 days - clock -38490314

If an unsigned integer was used instead, we would see this instead :

    24 days - clock 38016000
    25 days - clock 39600000

Unfortunately msclock() returning a signed integer also affects a
few other areas of JNOS for linux - things like the 'rtt' value used
in tcp, ip, and ax25 traffic, timeouts in the ftp client, dns queries,
and hop checks. So it's not just a matter of redefining msclock() to
return an unsigned integer.

To be honest with you, I'm not so sure I like the way the whole clock
thing is done to begin with - seems like alot of work just so that we
can keep track of when JNOS was first started ? Might change this ...

Anyways, it's clear what is going on here. I'll have a fix out shortly.

Maiko Langelaar / VE4KLM

Hi Maiko,

The signed integer approach might suggest a remedy for the problem of an
ever-increasing time value, where comparison of two times may fail due to
the crossover to a larger decade.  By periodically increasing the time clock
to a value, then decreasing the value to zero (effectively done by signing
the integer) the difference in time can always be determined, at least
within the window of the cycle.  The only problem is that a short
calculation needs to be done by the application to determine the absolute
value of the elapsed time.

Bill



_______________________________________________
nos-bbs mailing list
nos-bbs at tapr.org
https://www.tapr.org/cgi-bin/mailman/listinfo/nos-bbs





More information about the nos-bbs mailing list