On the Palm, TimGetSeconds() returns a local timestamp and you have to use 
TimTimeZoneToUTC() to get the UTC(GMT) time.

In Windows, the time() function returns a UTC timestamp and then you can use 
the localtime() function to convert it to local time.

So to fix my problem I save the timestamp on the Palm as UTC time then in my 
conduit I subtract 2082844800 (Palm time to Windows time conversion).  Now I 
have a Windows UTC timestamp so I just call localtime() to get the local 
time.

"Logan Shaw" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Jim McGowen wrote:
>
>> That's what I was thinking... but both the palm and the pc are set to the
>> same time zone so I don't understand why.  If this is the case then 
>> either
>> the Palm is giving me a timestamp from some other time zone or the PC is
>> interpreting the timestamp as being in some other timezone.  I don't get
>> it... a timestamp is a timestamp why would time zones even matter?
>
> Ultimately most computers run some sort of clock and supply
> functions to give you the local time or UTC (a/k/a GMT) time,
> depending which you want.
>
> The question is, does that native clock that the OS uses work
> in local time or in UTC?  In which case is it converting -- when
> you ask for local, or when you ask for UTC?
>
> The other question, is the answer to the previous question the
> same for Palm OS and for Windows?
>
>
> To put all this another way, the documentation for Palm OS's
> TimGetSeconds() says it returns "the number of seconds elapsed
> from 12:00 A.M. on January 1, 1904 to the current date and time".
> But is that 12:00AM, 1/1/1904 *local* time or UTC?  What about
> the analogous function call on Windows?
>
>
> Based on http://www.decimaltime.hynes.net/computers.html ,
> it would appear that Windows keeps time relative to a certain
> UTC time.  So, the next question is whether Palm OS keeps time
> in UTC or not.  Based on OS 4.0 example source, it seems that
> TimSecondsToDateTime() takes no account of time zones, and
> I believe you get the local time if you do
>
> TimSecondsToDateTime (TimGetSeconds(), datetimeptr);
>
> Therefore, it seems like TimGetSeconds() is giving you the
> number of seconds since the clock struck 12:00AM on 1/1/1904
> in YOUR time zone.  I don't know what function call you're
> using on Windows, so I can tell whether it uses local time,
> but if it isn't, you're going to have to do time zone
> correction.
>
> So, I *think* what you need to do is use the example code
> in the TimTimeZoneToUTC() documentation to convert
> TimGetSeconds() time to UTC.
>
>  - Logan
> 



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please 
see http://www.palmos.com/dev/support/forums/

Reply via email to