Valkyrie-MT
Posts: 3
Joined: Tue Aug 18, 2015 2:32 am

Real Time Clock?

Tue Aug 18, 2015 2:40 am

Is there a Real Time Clock available on the Raspberry pi 2? If so, does Windows IoT support it ?

Thanks,
Valkyrie-MT

User avatar
rpdom
Posts: 16315
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Real Time Clock?

Tue Aug 18, 2015 6:23 am

No. There is no hardware RTC on the Pi. The time is lost when it is switched off.

ame
Posts: 3172
Joined: Sat Aug 18, 2012 1:21 am
Location: New Zealand

Re: Real Time Clock?

Tue Aug 18, 2015 6:45 am

Valkyrie-MT wrote:Is there a Real Time Clock available on the Raspberry pi 2? If so, does Windows IoT support it ?

Thanks,
Valkyrie-MT
As mentioned, there is no real-time clock. It is an OS function. Under Linux (Raspbian), the clock is set by ntp if the Pi is connected to a network. If there is no network then the clock will start counting from the beginning of the epoch (00:00, Thursday, 1 January 1970).

If you know you will never have a network connection then you can add a hardware RTC, such as this:
http://www.dx.com/p/ds3231-raspberry-pi ... ack-277258

Or you could hook up a GPS (USB or serial) and read the current time (and set the clock) from that.

Under winiot you'd have to ask MS how it works.

UndergroundFun
Posts: 44
Joined: Wed Jun 17, 2015 12:57 pm

Re: Real Time Clock?

Tue Aug 18, 2015 5:19 pm

I've been working on time synchronization. I can get it to sync to our domain controller, but only when I run the resync manually from PowerShell when connected to the Pi. (w32tm /resync /force)

Ideally I'd be able to just run the same command from application code when it starts up. But I haven't been able to get that to work yet.

bgreer5050
Posts: 3
Joined: Tue Apr 28, 2015 7:40 pm

Re: Real Time Clock?

Mon Dec 28, 2015 1:50 pm

I have addressed this issue by creating a task that runs on boot-up and every 15 minutes.

Create a file "SyncTime.ps1" on the Pi containing the PowerShell script to run "w32tm /resync /force".

Then run this script to create a scheduled task that runs it on start up.

schtasks /Create /SC ONSTART /TN TimeSync /TR c:\SyncTime.ps1

That will force it to sync the time when it starts up. It seems this registry key below also needs to be set to your NTP server that it's going to sync to. Mine is set to our domain controller and it's working fine.

set-itemproperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\W32Time\Parameters -Name NtpServer -Value 127.0.0.1,0x9

You will have to change 127.0.0.1 to an IP that has a time service.

Source:
https://social.msdn.microsoft.com/Forum ... WindowsIoT

ricl
Posts: 657
Joined: Wed Aug 26, 2015 11:55 am

Re: Real Time Clock?

Mon Dec 28, 2015 3:52 pm

Please note that, like Linux, Windows 10 Core IoT also uses network time if it is available, straight out of the box. You should only need to switch to a local time server if, for some reason, the Pi cannot 'see' the outside world on boot.
ricl : F/gamma = ma : Law ii(a) : https://climatedatablog.wordpress.com/2016/01/02/an-energy-challenge-2016/ #AnEnergyChallenge2016

Return to “Windows 10 for IoT”