none
WinCE 6.0 SNTP Time Update Bug From Network Change RRS feed

  • Question

  • After I have debug the SNTP to my WinCE 6.0 platform, I found a bug from SNTP driver. It should be "TimeRefreshThread () calling RefreshTimeFromServer () locking problem". It should be not difficult to solve the problem but I think Microsoft should solve it for all version of WinCE. I don't want to rework that easy bug time to time by myself.

    I have update the VS2005 with the latest WinCE 6.0 fix "Windows Embedded CE 6.0 Monthly Update May 2013".

    The problem is about the "[TIMESVC] Network up/down event from OS" event trigger twice and two thread try to update at the same time. As a result, the first change is correct but the second change is error.

    Following is the problem log from debug output.

    ***********************************************************************************

    Windows CE Kernel for ARM (Thumb Enabled) Built on Mar  8 2013 at 17:05:33

    ...

    [OAL] --OEMInit()

    ...

    OEMSetRealTime(2013/5/1 12:0:0.000)

    ... LAN driver ...

    ... WIFI driver ...

    ... RIL driver ...

    [TIMESVC] Module loaded
    [TIMESVC] State reinitialized

    ...

    [TIMESVC] NTP_Init
    [TIMESVC] Start Server request from OS
    [TIMESVC] Refreshing configuration
    [TIMESVC] State reinitialized
    [TIMESVC] Configuration: sntp server           : stdtime.gov.hk
    [TIMESVC] Configuration: client                : enabled
    [TIMESVC] Configuration: server                : disabled
    [TIMESVC] Configuration: regular refresh       : 2147483647 ms (24 day(s))
    [TIMESVC] Configuration: accelerated refresh   : 2147483647 ms (24 day(s))
    [TIMESVC] Configuration: adjustment threshold  : 86400000 ms
    [TIMESVC] Service starting
    [TIMESVC] Client: schedule time update in 0 ms
    [TIMESVC] Service started successfully
    [TIMESVC] Start Server request : 0
    [TIMESVC] Refresh Event
    [TIMESVC] NotifyThread started
    [TIMESVC] Time Refresh: host stdtime.gov.hk is not reachable
    [TIMESVC] Time Refresh: all servers queried, but time not updated.
    [TIMESVC] Time Refresh failed, rescheduling
    [TIMESVC] Client: schedule time update in 2147483647 ms
    [TIMESVC] Server: Time changed - multicast now?
    [TIMESVC] Time Refresh event processing completed
    [TIMESVC] Network up/down event from OS
    [TIMESVC] Client: schedule time update in 0 ms
    [TIMESVC] Time update request : 0
    [TIMESVC] Refresh Event

    ... AutoRas RIL Cellular Line Dial Up ...

    [TIMESVC] Time Refresh: host stdtime.gov.hk is not reachable
    [TIMESVC] Time Refresh: all servers queried, but time not updated.
    [TIMESVC] Time Refresh failed, rescheduling
    [TIMESVC] Client: schedule time update in 2147483647 ms
    [TIMESVC] Server: Time changed - multicast now?
    [TIMESVC] Time Refresh event processing completed
    [TIMESVC] Network up/down event from OS
    [TIMESVC] Client: schedule time update in 0 ms
    [TIMESVC] Time update request : 0
    [TIMESVC] Refresh Event
    [TIMESVC] NTP_IOControl 0x01040040
    [TIMESVC] Network up/down event from OS
    [TIMESVC] Client: schedule time update in 0 ms
    [TIMESVC] Time update request : 0
    [TIMESVC] Refresh Event
    [TIMESVC] NTP_IOControl 0x01040040
    [TIMESVC] Time Refresh: querying server stdtime.gov.hk
    [TIMESVC] Sending SNTP request

    SNTP Packet:
    Leap      : 0 (No warning)
    Version   : 4
    Mode      : 3 (client)
    Stratum   : 0
    Poll      : 0
    Precision : 0
    Root delay: 0x00000000 (0 sec)
    Root disp : 0x00000000 (0 sec)
    Refid     : 00000000 (or 0.0.0.0)
    Reference time: 01/01/1900 00:00:00.000
                                           Origination time: 01/01/1900 00:00:00.000

    Received time: 01/01/1900 00:00:00.000
                                          Transmitted time: 05/01/2013 04:00:53.000


    [TIMESVC] Time Refresh: sent request, awaiting response
    [TIMESVC] Time Refresh: querying server stdtime.gov.hk
    [TIMESVC] Sending SNTP request

    SNTP Packet:
    Leap      : 0 (No warning)
    Version   : 4
    Mode      : 3 (client)
    Stratum   : 0
    Poll      : 0
    Precision : 0
    Root delay: 0x00000000 (0 sec)
    Root disp : 0x00000000 (0 sec)
    Refid     : 00000000 (or 0.0.0.0)
    Reference time: 01/01/1900 00:00:00.000
                                           Origination time: 01/01/1900 00:00:00.000

    Received time: 01/01/1900 00:00:00.000
                                          Transmitted time: 05/01/2013 04:00:54.000


    [TIMESVC] Time Refresh: sent request, awaiting response
    [TIMESVC] Received SNTP response

    SNTP Packet:
    Leap      : 0 (No warning)
    Version   : 4
    Mode      : 4 (server)
    Stratum   : 1
    Poll      : 3
    Precision : 3
    Root delay: 0x00000000 (0 sec)
    Root disp : 0x00000007 (1 sec)
    Refid     : 4d525300 (or 0.83.82.77)
    Reference time: 07/18/2013 03:08:55.036
                                           Origination time: 05/01/2013 04:00:53.000

    Received time: 07/18/2013 03:08:55.467
                                          Transmitted time: 07/18/2013 03:08:55.467


    OEMSetRealTime(2013/7/18 11:8:55.000)
    [TIMESVC] Time Refresh: time accepted. offset = 6736081 s.
    [TIMESVC] Time Refresh: old time: 05/01/2013 04:00:54.000
    [TIMESVC] Time Refresh: new time: 07/18/2013 03:08:55.967
    [TIMESVC] Client: schedule time update in 2147483647 ms
    [TIMESVC] Time successfully refreshed
    [TIMESVC] Server: Time changed - multicast now?
    [TIMESVC] Time Refresh event processing completed
    [TIMESVC] Received SNTP response

    SNTP Packet:
    Leap      : 0 (No warning)
    Version   : 4
    Mode      : 4 (server)
    Stratum   : 1
    Poll      : 3
    Precision : 3
    Root delay: 0x00000000 (0 sec)
    Root disp : 0x00000008 (2 sec)
    Refid     : 4d525300 (or 0.83.82.77)
    Reference time: 07/18/2013 03:08:55.036
                                           Origination time: 05/01/2013 04:00:54.000

    Received time: 07/18/2013 03:08:55.650
                                          Transmitted time: 07/18/2013 03:08:55.650


    OEMSetRealTime(2013/8/26 10:42:56.000)
    [TIMESVC] Time Refresh: time accepted. offset = 3368040 s.
    [TIMESVC] Time Refresh: old time: 07/18/2013 03:08:56.000
    [TIMESVC] Time Refresh: new time: 08/26/2013 02:42:56.650
    [TIMESVC] Client: schedule time update in 2147483647 ms
    [TIMESVC] Time successfully refreshed
    [TIMESVC] Server: Time changed - multicast now?
    [TIMESVC] Time Refresh event processing completed

    ***********************************************************************************

    Thursday, July 18, 2013 4:16 AM

All replies

  • I agree that MS should fix any serious bugs. This, however, is not a method to make that happen. The number of MS team members following the thread is small. You need to call MS for support (you should get some technical support incidents with Platform Builder), report the bug, as you've done, and request a new QFE to fix it.

    I think that, given the age of Windows CE 6, the chances of actually getting a QFE for a legacy issue that old are small. If it were me, I'd fix it myself for my customers and hope that MS eventually does something.

    Paul T.

    Thursday, July 18, 2013 11:28 PM
  • C:\WINCE600\PUBLIC\FP_VOIP\OAK\PHONE\COMMON\UTILS\timeutilities.cpp

    has a function called RestartTimeService() that calls "Set" followed by "refresh" (stop -> start - > read registry config).

    I think the order of commands seems to be unexpectedly important and unintuitive.

    I would have expected a "Set" command to be sent AFTER a "refresh" (or "start") command.

    I admit I don't understand why this order works better but I think it avoids the 'bug' experienced by the original poster.

    Tuesday, May 12, 2015 12:08 PM