0

I was converting a timestamp here, when I red the following:

It should also be pointed out (thanks to the comments from visitors to this site) that this point in time technically does not change no matter where you are located on the globe. This is very useful to computer systems for tracking and sorting dated information in dynamic and distributed applications both online and client side.

I could not understand what this exactly means: is the unix timestamp an absolute measure?

That is: suppose I have a client in the USA and this client connects to a server located in Russia. Does the Unix timestamp is exactly the same in the same moment for both the client and the server? I'm a little confused...

3000
  • 103
  • 1
    Yes, the timestamp is a unique number that designates the same instant all over the globe. But you cannot give it a text representation (YYMMDD HH:MM:SS) without knowing the target timezone. – xenoid Dec 01 '17 at 21:18
  • @xenoid: ok, ok, now things are far more clear for me – 3000 Dec 02 '17 at 08:13

3 Answers3

3

On a correctly-configured machine, the unix timestamp is the number of seconds after Jan 1 1970 00:00:00 UTC. Thus, it would be the same regardless of what country or time zone the user or the computer is in.

hymie
  • 1,710
  • 2
    More precisely than "correctly-configured", maybe: "on a machine that's time-synchronized to (now)" – Jeff Schaller Dec 01 '17 at 17:08
  • When I found that website, I was testing an iOS app (trying to figure out what caused a little bug). Anyway, a little search pointed me to (many) answers like this one https://stackoverflow.com/questions/6740546/nsdate-datetimeintervalsince1970-seems-to-be-1hr-behind, where some users seem to suggest there was the need of an "adjust" to compare local and remote timestamps – 3000 Dec 01 '17 at 17:22
3

Obviously the server clocks could be out of sync.

But the point is, the correct value for the timestamp at any given moment is identical regardless of location.

Your example isn't quite relevant because there would be some latency between Russia and the U.S., so even with accurate clocks you could get two different timestamps. But they wouldn't be hours apart. They would be (barring network problems) only in the range of seconds apart.

Wildcard
  • 36,499
3

Timestamp 0 corresponds to a precise instant in time (not related to any timezone) also know as 1970-01-01 00:00:00 UTC (though UTC didn't exist at the time).

timestamp 1512148141 is 1512148141 seconds after that, with those seconds not atomic seconds but the average 86400th part of an Earth day.

Again, that's an instant in time that is in reference to a fixed instant in time, not related to any timezone.

That's 2017-12-01T17:09:01 UTC or 2017-12-01T11:09:01-06:00 in Chicago or 2017-12-01T22:09:01+05:00 in Karachi, all referring to the same instant.