hi! Logan is correct. This is the piece of code I use to convert local time to UTC using the API.
Good luck.
Jerome

.....
::DateTimeType dt;
UInt32 seconds = TimGetSeconds();
        
if(PrefGetPreference(prefVersion) >= 9)
{
        Int16 tz = PrefGetPreference(prefTimeZone) & 0xffff;
        Int16 ds = PrefGetPreference(prefDaylightSavingAdjustment) & 0xffff;

        seconds = TimTimeZoneToUTC(seconds, tz, ds);
}
        
TimSecondsToDateTime(seconds, &dt);
y = dt.year;
m = dt.month;
d = (unsigned char)dt.day;
hh = (unsigned char)dt.hour;
mm = (unsigned char)dt.minute;
ss = (unsigned char)dt.second;
.......



Chris Apers wrote:
Hi,

Is this the good way to do this ?

 if (romVersion >= sysMakeROMVersion(4,0,0,sysROMStageRelease,0))
    secs += (PrefGetPreference(prefTimeZone) +
PrefGetPreference(prefDaylightSavingAdjustment)) * 60;
 else
    secs += (PrefGetPreference(prefMinutesWestOfGMT) - 720) * 60; // no sure
about this one

Thanks a lot :)
Chris


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

Reply via email to