6

I have a setup where my Pi is connected to power and to my router, and I then set up a connection with my laptop through SSH (a good setup for saving space, if you don't have a lot).

I fired up my Pi just now and noticed I could access the time, and it was correct.

So I'm wondering where this time infomation comes from? Presumably somehow through the SSH from the laptop, but I didn't think SSH did this, and the Pi is four minutes in front of the laptop's system time.

image of setup and time http://adams-site.x10.mx/v/timeonpi.png
click to enlarge

Is the Pi's time coming through SSH and four minutes being taken off?

  • 1
    Do you have NTP installed? – user46 Jul 16 '12 at 17:06
  • Sorry, got distracted. I really don't know. (Reading the answer, yes). – ACarter Jul 16 '12 at 17:15
4

Because your Pi is connected to the router and presumably to the internet, your Pi is getting and setting the time via NTP (network time protocol). You can find out more about NTP from this wikipedia entry, or directly from the maintainers of NTP

| improve this answer | |
  • Fresh installs have it pick up time from a variety of sources that can be many hops from the Master Clock. For details, and for the reason why you should change it to time.nist.gov, see this Q&A: raspberrypi.stackexchange.com/questions/68811/… – SDsolar Jun 24 '17 at 4:51
  • @sdsolar NIST May make sense in North America but it does not make sense for everyone in the world. – Steve Robillard Jun 24 '17 at 4:54
  • Good morning, @Steve. Actually it does. It is UTC so works everywhere. That particular URL is "smart" so no matter where you call it from it will find the quickest-responding Stratum-1 server for you. Here is more information about that: nist.gov/pml/time-and-frequency-division/… - of course, GPS is better everywhere in the world if you need better accuracy. Here's a great article on how Google does it world-wide: wired.com/2012/09/google-spanner – SDsolar Jun 24 '17 at 14:08
3

Is it possible the time on your laptop is wrong and the RPi is correct?

If the RPi has acquired the time at all, it will most likely be using ntp, and it's unlikely that it would set the time 4 minutes off unless the ntp server is broken

| improve this answer | |
  • Very probably, yes, though you'd think the laptop would be using NTP as well. – ACarter Jul 17 '12 at 7:09
  • 1
    @ACarter, looks like it's running Windows. I don't think Microsoft ever "got" how ntp is supposed to work. – John La Rooy Jul 17 '12 at 7:11
  • On a Windows machine, just click on the clock, and go into Internet time, change the server to time.nist.gov and click update. Then it will have it from a top-tier server - as close to the Master Clock as you can get on the Internet. For the Pi, see this Q&A here on this Stack Exchange: raspberrypi.stackexchange.com/questions/68811/… – SDsolar Jun 24 '17 at 4:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.