Campa Campa - 2 months ago 13
Bash Question

Unix time and leap seconds

Regarding Unix (POSIX) time, Wikipedia says:

Due to its handling of leap seconds, it is neither a linear representation of time nor a true representation of UTC.

But the Unix
command does not seem to be aware of them actually

$ date -d '@867715199' --utc
Mon Jun 30 23:59:59 UTC 1997
$ date -d '@867715200' --utc
Tue Jul 1 00:00:00 UTC 1997

While there should be a leap second there at
Mon Jun 30 23:59:60 UTC 1997

Does this mean that only the
command ignores leap seconds, while the concept of Unix time doesn't?


The number of seconds per day are fixed with Unix timestamps.

The Unix time number is zero at the Unix epoch, and increases by exactly 86400 per day since the epoch.

So it cannot represent leap seconds. The OS will slow down the clock to accommodate for this. The leap seconds is simply not existent as far a Unix timestamps are concerned.