vate
Posts: 7
Joined: Mon Feb 15, 2016 7:28 pm

Time zone

Mon Sep 05, 2016 8:44 am

Dear all
Iam new in Raspberry PI,. I have a problem with the Raspberry pi date
when I run the command date
Mon 5 Sep 03:33:24 PET 2016 ( Peru Time (Standard Time))
However, when I checked the real PET time (in web server http://www.timeanddate.com/time/zones/pet) the time is:
PET time now 3:41:

I don't understand the 8 minutes difference, I've already configured the raspberry time zone according to my city (Lima.-Peru)

BR
Walter

User avatar
nl3prc
Posts: 160
Joined: Sun Jul 24, 2016 12:39 pm
Location: Den Helder the netherlands

Re: Time zone

Mon Sep 05, 2016 9:50 am

i also have two times.
the one in my windows is about 6 minutes slow i think this is becouse a diferent server is used

User avatar
RaTTuS
Posts: 10484
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: Time zone

Mon Sep 05, 2016 9:56 am

try

Code: Select all

sudo /etc/init.d/ntp stop
sudo ntpd -q -g
sudo /etc/init.d/ntp start
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

epoch1970
Posts: 3781
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Time zone

Mon Sep 05, 2016 10:13 am

Linux, like a unix machine, counts time as the number of elapsed seconds since jan 1st, 1970, in coordinated universal time (UTC).
Then users can shift this UTC date/time to their own time zone, because everybody doesn't live in Greenwich, London. (https://en.wikipedia.org/wiki/List_of_UTC_time_offsets)

Your machine shows an inaccurate UTC date. Normally this is taken care of automatically by the NTP protocol.
The Pi is a little special in that it doesn't keep track of time that passes when it is powered down (there is no battery backed RTC unit.)
It could take a little while for the machine to sync to the correct UTC date after bootup.

There are quite a few threads on the forum related to NTP and timekeeping. I would advise patience first, and dig into these topics only if time doesn't get accurate after a few days of uptime. (Or use the recipe posted by RaTTus above to accelerate the process)
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

vate
Posts: 7
Joined: Mon Feb 15, 2016 7:28 pm

Re: Time zone

Mon Sep 05, 2016 2:45 pm

Dear all
Thank for your answers. I got those results

[email protected]:~ $ sudo /etc/init.d/ntp stop
[ ok ] Stopping ntp (via systemctl): ntp.service.
[email protected]:~ $ sudo ntpd -q -g
sudo: ntpd: command not found
[email protected]:~ $ sudo /etc/init.d/ntp start
[....] Starting ntp (via systemctl): ntp.serviceJob for ntp.service failed. See 'systemctl status ntp.service' and 'journalctl -xn' for details.
failed!

I don't have the ntp service enabled:

[email protected]:~ $ timedatectl
Local time: Mon 2016-09-05 09:32:50 PET
Universal time: Mon 2016-09-05 14:32:50 UTC
RTC time: n/a
Time zone: America/Lima (PET, -0500)
NTP enabled: no
NTP synchronized: no
RTC in local TZ: no
DST active: n/a

BR
Walter

User avatar
RaTTuS
Posts: 10484
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: Time zone

Mon Sep 05, 2016 3:07 pm

I though ntp was installed by default ... in jessie
sudo apt-get install ntp
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

Return to “Beginners”