SNTP Service not reloading from the Application RRS feed

  • Question

  • Hello All,

    We are trying to Integrate SNTP Service in our device which is Wi-Fi enabled. We want to take the updated Time and Date from the Default Gateway of infrastructure Network(Infrastructure Gateway as our Time Server). In our Application we set the Default Gateway IP in the Server field,when we get connected to the Network. But as the SNTP was started in the boot sequence with the earlier registry settings,so the updated server field in the SNTP Registry setting doesn't come in effect in the same boot.We need to restart the system for the service to start with the newer Registry settings.We don't want to restart the system,so we tried loading the dll at runtime by using ActivateServices() function.We have set the value of flag in the TIMESVC field as 0x12 and used the LoadLibrary function from our application to load the sntpsvc.dll with the new registry settings.But it's not updating the Time and Date value.

    Also this product doesn't connect with the mobile Network,but connects on the WiFi network.We want the automatic sync of the TimeZoneInformation from the Infrastructure Gateway(Time Server).I am not able to find any registry settings related to it. All the registry settings for Automatic sync of TimeZoneInformation are related to mobile network only.Is it possible to sync the TimeZoneInformation from a TimeServer,the way we update the Time using SNTP.

    Please help me in achieving this and feel free to revert if any more clarifications are required.

    • Edited by iesuser Tuesday, May 19, 2015 4:25 PM
    Tuesday, May 19, 2015 3:00 PM

All replies

  • So I think you've chosen the wrong way to fix the problem. What you want is for the time service to begin using the new registry entry after you change it. Your code isn't better or improved because you manually load the service, etc. Take a look at the SNTP service code. As I recall there's a REFRESH message (IOCTL_SERVICE_REFRESH) you can send to Services.exe from your application to reload parameters for specified service. I think you can also use IOCTL_SERVICE_CONTROL to trigger a sync with the server.

    There's no time zone sync defined in SNTP. You can build something, of course, yourself so it's "possible".

    Paul T.

    Thursday, May 21, 2015 6:17 PM
  • Hello,

    Thanks for the reply Paul.I am still working on synchronizing my device with the Time zone of the Device Location. One possible way which I was thinking,is getting the Time Zone of the Time server from where my device is getting time, and set that TimeZone from the Application.But I am not able to find any API which will return me the TimeZone of the Time Server. Is there any available API to retrieve this value from the Time Server.

    The another Possible way can be to get the Time Zone from the Default Gateway of my device.As we know that we set the TimeZone in all the Access Points and Default Gateway is basically the IP Addresss of the Access Point or network Controller,my device is connecetd with.So,We can get the TimeZone from the Default Gateway and set it from my application.But for this also I am not able to find any Windows API to get the TimeZone from the Default Gateway.

    It would be a great if you can please help me in finding these API's or suggest me some another way to get the TimeZone of the Device.

    Monday, May 25, 2015 8:35 AM
  • There is no API to get the time zone of the time server. Since the time server is NOT RETURNING LOCAL TIME BUT COORDINATED UNIVERSAL TIME, its time zone is irrelevant in SNTP transactions and SNTP therefore doesn't care about the zone. No matter where the client is located, setting its time to match the server is fine; only the CUT value is set, not LOCAL time. The actual local time is adjusted based on the CUT from the server and the TIME ZONE OFFSET OF THE CLIENT. The client must know its correct time zone.

    You can build your own API to retrieve the time zone from your gateway, I guess, but you'll need code on both ends or you'll need to use some information API already on the gateway which is remotely accessible (WMI, maybe? I don't know).

    Paul T.

    Wednesday, May 27, 2015 7:19 PM