Click to See Complete Forum and Search --> : Time function


arunjohnb
June 26th, 2008, 03:50 AM
Dear All,

SetLocalTime API is working fine in Win Mobile 5.0.But SetSystemTime is giving a time diff of eight hours ahead.I am working on Win Mobile 5.0 SDK platform.

Please help....

GremlinSA
June 26th, 2008, 07:57 AM
You need to offset the time for the TimeZone...

SetSystemTime
This function sets the current system time and date. The system time is expressed in UTC.

SetTimeZoneInformation
This function sets the current time-zone parameters. These parameters control translations from UTC to local time.


Remarks
SetTimeZoneInformation does not change the clock and therefore will not affect subsequent calls to GetLocalTime. SetTimeZoneInformation only affects subsequent calls to GetSystemTime.

SetTimeZoneInformation does not save the newly written data into the persistent registry. To write the data permanently, you need to make the following call: RegFlushKey(HKEY_LOCAL_MACHINE). For more information, see RegFlushKey.

All translations between UTC and local time are based on the following formula.

UTC = local time + bias
The bias is the difference, in minutes, between UTC and local time.

Hope this Helps....

Gremmy