User avatar
some_evil
Posts: 205
Joined: Thu Dec 18, 2014 3:16 am
Location: Albury, Australia

Incorrect Time on my Standalone Pi

Mon Mar 16, 2015 11:55 pm

Hi Guys,

I have my Pi set up 'off the grid' where no internet access is available. Its job is to sit there logging temperatures throughout the day.

As it is logging data, it places a timestamp next to the temperature. What I have found is that now that I have disconnected the Pi from the internet, the time has changed to be incorrect.

I am in Australia, and the time is approx 7 days and 37 mins behind what it should be.

I have connected it to the net while setting it up, and I guess the time must have automatically been adjusted when it was connected, but now I have disconnected it has changed for some reason.

Is there a way I can tell it the time and it not try to adjust itself when it comes on and offline???

Thanks for your time.
PiZeroW - May 2017
Pi 3 - Oct 2016
PiZero - June 2016
Pi 2 - Jan 2016
Pi B+ - Dec 25 2014

User avatar
pluggy
Posts: 3635
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
Contact: Website

Re: Incorrect Time on my Standalone Pi

Mon Mar 16, 2015 11:57 pm

Don't judge Linux by the Pi.......
I must not tread on too many sacred cows......

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

Re: Incorrect Time on my Standalone Pi

Tue Mar 17, 2015 1:10 am

The Pi does not have an onboard RTC. In "normal" operation it is expected that the Pi is connected to the network and can pick up the time from a network source somewhere.

If you are not connected to any network then this cannot work, so you have to provide an alternative time source. Popular time sources are:
1) Typing the time and date manually
2) Using a GPS module
3) Using an RTC module

This is probably the cheapest RTC module you can find:
http://www.dx.com/p/ds3231-raspberry-pi ... Qd-WY7Ue7Q

It plugs onto the GPIO header and needs some (easily available) driver software. The first time you use it you have to set the time, but it keeps accurate time from then on. The battery is not rechargeable, but it's only needed to maintain the time when the power is off.

User avatar
some_evil
Posts: 205
Joined: Thu Dec 18, 2014 3:16 am
Location: Albury, Australia

Re: Incorrect Time on my Standalone Pi

Tue Mar 17, 2015 5:05 am

ame wrote:Popular time sources are:
1) Typing the time and date manually
So if I set the time and date when I start up the pi, unless I have to shutdown/restart it should hold that manually set time from then on???

I never clicked that it was a restart that lost the time, I assumed it was a loss of network connectivity that lost the time/date.... it seems so obvious now!

Thanks for your help guys.
PiZeroW - May 2017
Pi 3 - Oct 2016
PiZero - June 2016
Pi 2 - Jan 2016
Pi B+ - Dec 25 2014

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

Re: Incorrect Time on my Standalone Pi

Tue Mar 17, 2015 5:11 am

some_evil wrote:
ame wrote:Popular time sources are:
1) Typing the time and date manually
So if I set the time and date when I start up the pi, unless I have to shutdown/restart it should hold that manually set time from then on???

I never clicked that it was a restart that lost the time, I assumed it was a loss of network connectivity that lost the time/date.... it seems so obvious now!

Thanks for your help guys.

The Pi will keep time whilst it is running, but it may drift, sometimes considerably.

Return to “Troubleshooting”