Discussion:
SetLocalTime not updating daylight/standard time
(too old to reply)
Mark Galli
2007-11-14 12:45:59 UTC
Hi,

On HP iPAQs running Windows Mobile 5.0, I use the function SetLocalTime to
set the time and date. If the device is currently in standard time, and I
set the date to something in daylight savings time, the function
GetTimeZoneInformation still returns TIME_ZONE_ID_STANDARD indicating that
the OS still thinks it's in standard time. Likewise, if the device is in
daylight time and I use SetLocalTime to set to a time and date in standard
time, GetTimeZoneInformation returns TIME_ZONE_ID_DAYLIGHT. Anyone have
any ideas how to force the OS to update? I've installed the timezone
update.

Thanks,
Mark
"Michael Salamone" <mikesa#at#entrek#dot#com>
2007-11-15 03:25:23 UTC
Look at the Win32 help for SetLocalTime. Here's an excerpt from MSDN:

The system uses UTC internally. Therefore, when you call SetLocalTime, the
system uses the current time zone information to perform the conversion,
including the daylight saving time setting. Note that the system uses the
daylight saving time setting of the current time, not the new time you are
setting. Therefore, to ensure the correct result, call SetLocalTime a second
time, now that the first call has updated the daylight saving time setting.


Don't know if this is the prescribed way to do it for WinCE, but it should
be. Give it a try (and please report back - I'm curious to know).
--
Michael Salamone, eMVP
Entrek Software, Inc.
www.entrek.com
Post by Mark Galli
Hi,
On HP iPAQs running Windows Mobile 5.0, I use the function SetLocalTime to
set the time and date. If the device is currently in standard time, and I
set the date to something in daylight savings time, the function
GetTimeZoneInformation still returns TIME_ZONE_ID_STANDARD indicating that
the OS still thinks it's in standard time. Likewise, if the device is in
daylight time and I use SetLocalTime to set to a time and date in standard
time, GetTimeZoneInformation returns TIME_ZONE_ID_DAYLIGHT. Anyone have
any ideas how to force the OS to update? I've installed the timezone
update.
Thanks,
Mark
Mark Galli
2007-11-19 17:23:41 UTC
Hi Micahel,
Thanks for the reply. I've tried this and it didn't work.
Mark
Post by "Michael Salamone" <mikesa#at#entrek#dot#com>
The system uses UTC internally. Therefore, when you call SetLocalTime, the
system uses the current time zone information to perform the conversion,
including the daylight saving time setting. Note that the system uses the
daylight saving time setting of the current time, not the new time you are
setting. Therefore, to ensure the correct result, call SetLocalTime a
second time, now that the first call has updated the daylight saving time
setting.
Don't know if this is the prescribed way to do it for WinCE, but it should
be. Give it a try (and please report back - I'm curious to know).
--
Michael Salamone, eMVP
Entrek Software, Inc.
www.entrek.com
Post by Mark Galli
Hi,
On HP iPAQs running Windows Mobile 5.0, I use the function SetLocalTime
to set the time and date. If the device is currently in standard time,
and I set the date to something in daylight savings time, the function
GetTimeZoneInformation still returns TIME_ZONE_ID_STANDARD indicating
that the OS still thinks it's in standard time. Likewise, if the device
is in daylight time and I use SetLocalTime to set to a time and date in
standard time, GetTimeZoneInformation returns TIME_ZONE_ID_DAYLIGHT.
Anyone have any ideas how to force the OS to update? I've installed the
timezone update.
Thanks,
Mark