8

The Problem I have 4 Raspberry Pis running on my local network. All 4 Raspberry Pis are posting messages every 5 seconds to an Azure IoT hub.

The problem is that when time drifts off, I'm getting authentication errors from the IoT hub and then my app crashes.

I have noticed that when connected via a network cable there is no issue. But errors are much more common on WiFi. Using WiFi is the desired use case.

I have also observed that power cycling will not trigger Windows IoT to update the time, but a restart will.

My current strategy I want to trigger the same time update mechanism that happens on a restart but in a controlled manner. I'm currently attempting to have a power-shell script run every hour to resync.

Where I need help I'm trying to run the command w32tm /resync /force but when I do I get the following error. Sending resync command to local computer The computer did not resync because no time data was available.

I have no idea why. This makes be think that maybe Windows IoT is using something else to get the current time. I really have not clue.

Any suggestion would be greatly appreciated.

tlhIngan
  • 3,342
  • 5
  • 18
  • 33

2 Answers2

1

The Windows IoT hub only requires 2-second resolution to prevent auth errors. Rather than forcing a resync every hour, you just need to configure the w32tm to use the same NTP servers as your RPis:

w32tm /config /manualpeerlist:"0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org" /syncfromflags:manual /reliable:yes /update

Note the removal of time.windows.com. It is critical here to pass the /update flag otherwise the change will not be activated. From the w32tm docs:

Changes to configuration are not used by Windows Time unless the service is restarted or the /update switch is used.

0

Those darn error messages. Instead of saying that there are no servers in the list to connect to - it generically returns no time data was found :D

Try this command with your resync/force flags

w32tm /config /syncfromflags:manual /manualpeerlist:"0.windows.time.com 1.pool.ntp.org" /resync /force

On startup there must be something similar supplying NTP servers.

You can use any time server you like even a local NTP server if you can set one up.

Piotr Kula
  • 17,168
  • 6
  • 63
  • 103