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?

Oliver Salzburg
  • 1,684
  • 1
  • 19
  • 33
ACarter
  • 2,220
  • 6
  • 23
  • 39

2 Answers2

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

tlhIngan
  • 3,342
  • 5
  • 18
  • 33
Steve Robillard
  • 34,158
  • 17
  • 102
  • 108
  • 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: https://raspberrypi.stackexchange.com/questions/68811/how-do-i-set-raspbian-to-use-the-primary-time-server-time-nist-gov – SDsolar Jun 24 '17 at 04: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 04: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: https://www.nist.gov/pml/time-and-frequency-division/nist-time-frequently-asked-questions-faq - 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: https://www.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

John La Rooy
  • 11,847
  • 9
  • 46
  • 74
  • Very probably, yes, though you'd think the laptop would be using NTP as well. – ACarter Jul 17 '12 at 07: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 07: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: https://raspberrypi.stackexchange.com/questions/68811/how-do-i-set-raspbian-to-use-the-primary-time-server-time-nist-gov – SDsolar Jun 24 '17 at 04:53