Win2k doesn't send WM_TIMECHANGE on daylight savings event

Discussion in 'Microsoft Windows 2000 Developer' started by Daniel Anderson, Jan 15, 2004.

  1. I seem to have a problem under win2k. Applications relying
    on the WM_TIMECHANGE message to do recalculations when the
    local time changes will fail. If the clock is changed
    either manually or through synchronization via our LAN, the
    message is received loud and clear. But at 2AM on a day
    going into or out of daylight savings time, there is no
    message sent by the os. My bios does not have the ability
    to adjust for daylight savings time, so there is no
    interference there. Under XP, applications receive this
    message as expected. Anyone else find this? My
    understanding is that Pre-NT5 os requires all apps to send
    this message to all top level windows when they changed the
    system time, and NT5+ handles WM_TIMECHANGE on its own with
    no application to send. It seems as though the W2K codeset
    responsible for the DST changeover does not comply with the
    design.

    Platform: Windows 2000 SP3, SP4
    Timezone: GMT -3:00 Greenland
    Times: (Scenario 1) April 4, 2004, 1:59 AM
    (Scenario 2) October 31, 2004, 1:59 AM
    Application: A simple C++ MFC SDI application, handling
    WM_TIMECHANGE. Also tested with C application running as a
    service but registered as a windows class, handling
    WM_TIMECHANGE.

    In Scenario 1, the time and date is set to the specified.
    At 2:00AM, the clock display jumps to 3:00AM, as expected.
    No WM_TIMECHANGE message is recieved by the application
    under W2K, however it does with XP.

    In Scenario 2, the time and date is set to the specified.
    At 2:00AM the clock display jumps back to 1:00AM, as
    expected. No WM_TIMECHANGE message is recieved by the
    application under W2K, however it does with XP.


    Cheers,
    Dan
     
    Daniel Anderson, Jan 15, 2004
    #1
    1. Advertisements

  2. According to the following MSDN article, Windows 2000 and
    XP should behave the same way. But during a daylight
    savings change, XP sends WM_TIMECHANGE to applications, but
    2000 does not. Why? Where is this documented?

    ----------------------
    WM_TIMECHANGE
    An application sends the WM_TIMECHANGE message whenever it
    updates the system time.

    To send this message to all top-level windows, an
    application can use the SendMessage function with the hWnd
    parameter set to HWND_TOPMOST.

    Windows 2000/XP: An application should not broadcast this
    message, because the system will broadcast this message
    when the application changes the system time.

    Windows NT 4.0 and earlier: An application should send this
    message to all top-level windows after changing the system
    time.

    Windows 95/98/Me: An application should send this message
    to all top-level windows after changing the system time.

    ----------------------
     
    Daniel Anderson, Jan 29, 2004
    #2
    1. Advertisements

  3. I've seen the same behaviour Daniel, at least on the Win2k side. I'll try
    with my WinXP machine when I get home tonight.

    My first thought was that because the documentation for WM_TIMECHANGE says
    that it is broadcast when the -=system time=- changes (which is always in
    GMT), that it would make sense that it would -=not=- be broadcast when
    entering or leaving DST (wouldn't explain the XP issue, but still...). But
    when I change the time zone on my Win2k system, a WM_TIMECHANGE message is
    fired.

    As a workaround, you could:
    - check the local time every few seconds or so (yuck)
    - change your calculations to be based on GMT
    - watch the
    HKLM\System\CurrentControlSet\Control\TimeZoneInformation\ActiveTimeBias
    value by using RegNotifyChangeKeyValue() (this value changes when there is a
    DST transition as well as when the time zone changes).



    --
    John Phillips
    MVP - Windows SDK



    "Daniel Anderson" <> wrote in message
    news:65fb01c3e632$12b08f20$...
    > According to the following MSDN article, Windows 2000 and
    > XP should behave the same way. But during a daylight
    > savings change, XP sends WM_TIMECHANGE to applications, but
    > 2000 does not. Why? Where is this documented?
    >
    > ----------------------
    > WM_TIMECHANGE
    > An application sends the WM_TIMECHANGE message whenever it
    > updates the system time.
    >
    > To send this message to all top-level windows, an
    > application can use the SendMessage function with the hWnd
    > parameter set to HWND_TOPMOST.
    >
    > Windows 2000/XP: An application should not broadcast this
    > message, because the system will broadcast this message
    > when the application changes the system time.
    >
    > Windows NT 4.0 and earlier: An application should send this
    > message to all top-level windows after changing the system
    > time.
    >
    > Windows 95/98/Me: An application should send this message
    > to all top-level windows after changing the system time.
    >
    > ----------------------
    >
    >
     
    John Phillips, Jan 29, 2004
    #3
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bamer127

    Hyperthreading for Win2k

    bamer127, Jul 1, 2003, in forum: Microsoft Windows 2000 Developer
    Replies:
    1
    Views:
    757
    Joe Richards [MVP]
    Jul 3, 2003
  2. Pat

    COMCTL32.OCX Version 5 (SP2) on WIN2K

    Pat, Jul 31, 2003, in forum: Microsoft Windows 2000 Developer
    Replies:
    0
    Views:
    867
  3. John

    vb.net exe not working after update of sp4 for win2k

    John, Aug 15, 2003, in forum: Microsoft Windows 2000 Developer
    Replies:
    0
    Views:
    473
  4. Jeff

    SCript doesnt work

    Jeff, Jul 19, 2004, in forum: Microsoft Windows 2000 Developer
    Replies:
    0
    Views:
    225
  5. Eiji Hori

    Only Win2K problem? Win2K ask CD-ROM even if I copy file to HDD...

    Eiji Hori, Sep 29, 2004, in forum: Microsoft Windows 2000 Developer
    Replies:
    0
    Views:
    310
    Eiji Hori
    Sep 29, 2004
Loading...

Share This Page