Taapo
Taapo

Reputation: 1987

Epoch time with dot? 1391759952.7056

I'm using an API that returns "1391759952.7056" as a timestamp. I was wondering what the numbers behind the dot mean? As far as I know only 10 characters get used for Epoch time ...

Upvotes: 17

Views: 31075

Answers (2)

Sandman
Sandman

Reputation: 2755

If it were 1391759952.705 * 1000 it would be milliseconds. You seem to have one extra decimal! In Java, you would get this (1391759952705) with System.currentTimeMillis(). As a detail, in Java, the biggest range is given by System.nanoTime() - nanoseconds (faster than currentMillis() to my knowledge but not relative to a fixed point in time so it would be more suitable for measuring elapsed times, not the current time).

Upvotes: 6

candita
candita

Reputation: 101

Definitely fractions of a second, see https://en.wikipedia.org/wiki/ISO_8601

Run a couple of tests from the command line:
$ date -Ins -d@1452550837
2016-01-11T22:20:37,000000000+0000
$ date -Ins [email protected]
2016-01-11T22:20:37,010000000+0000
$ date -Ins [email protected]
2016-01-11T22:20:37,000010000+0000

Tends to be inconvenient when parsing Unix times in Go.

Upvotes: 5

Related Questions