Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 ...

like image 216
Taapo Avatar asked Feb 11 '14 08:02

Taapo


People also ask

Can epoch time have decimals?

No. epoch time is how time is kept track of internally in UNIX. It's seconds, counting upward from January 1st, 1970. This number hit 1 million (1,000,000) in March of 1973, and will hit one billion (1,000,000,000) on Sun Sep 9 01:46:39 2001 UTC.

How do you calculate epoch time?

POSIX defines that you can deduce the number of days since The Epoch (1970-01-01 00:00:00Z) by dividing the timestamp by 86400. This deliberately and consciously ignores leap seconds.

How do I convert epoch time to GMT?

=(A1 / 86400) + 25569 Format the result cell for date/time, the result will be in GMT time (A1 is the cell with the epoch number). For other time zones: =((A1 +/- time zone adjustment) / 86400) + 25569.

Why is Jan 1 1970 the epoch?

January 1st, 1970 at 00:00:00 UTC is referred to as the Unix epoch. Early Unix engineers picked that date arbitrarily because they needed to set a uniform date for the start of time, and New Year's Day, 1970, seemed most convenient.


1 Answers

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.

like image 60
candita Avatar answered Sep 20 '22 14:09

candita