Topics:
1.      Is it possible to keep UTC time and correct for time zone?
2.      Is there a bug in %lu format for StrPrintF?

Question 1.     
I wrote 3 simple lines of code to check out the time system
on the palm organiser (Palm IIIx, palmos 3.1):

            unsigned long t = TimGetSeconds();
            StrPrintF(linebuf, "time = %lu", t);
            FrmCustomAlert(id_alert_custom1, linebuf, "", "");

The answer I got just now is:

-1284182321

at Fri May 28 15:39:42 GMT 1999 (local time = Sat May 29 01:09:38 CST 1999).

Adding 4294967296 (2^32) to this gives 3010784975.

The number of seconds since 1 Jan 1904 UTC 0000 is 
34846 days + 15 hrs + 39 mins + 42 secs = 3010750782,
which differs from the above by 34193 seconds, or 9.498 hours.
I.e. the clock is showing my local time (UTC+0930).

However, the Welcome application asks me what country I'm in while
setting the time. I ahd assumed that this would mean that
internally the clock would be kept in UTC and then converted to
local time for the user.
This does not seem to be so, and I can't find documentation
which says that time is not kept as UTC internally.

Question: Is it possible to rearrange things so that the organiser
does indeed keep UTC internally and displays local time for user
applicaitons (apart from rewriting all the applications)?
I wanted to be able to record times of events as UTC, and also
be able to read the local timezone offset - in the style of Unix and C.

Question 2:
Is there a bug in StrPrintF which makes it print a negative
number for the %lu format? It looks like the "l" has been interpreted
as meaning signed, not matter what comes afterwards.
The documentation clearly says that %lu is supposed to be unsigned long.

Cheers,
Alan Kennington.

Reply via email to