Unix/Posix/Epoch Time

Coordinated Universal Time (UTC) is the primary time standard by which all the clocks in the world are regulated. The UTC time OO:OO:OO was started on  OO:OO:OO, Thursday, 1 January 1970. The Epoch time is the measurement of instants of time in seconds that have elapsed since then. It’s widely used in Unix-like and many other OSes and file formats.

Unix time can be checked in most Unix-like OSes by running date +%s

deepak@ubuntu:~$date +%s

This means since OO:OO:OO of 1 January 1970, total number of seconds that have elapsed is 1437812556. Diving this number by 86400(total no. of seconds in a day) gives the number of days since 1 January 1970.

1437812556 / 86400 = 16641.349027778

The epoch time is used throughout the Linux, for instance the third field in the /etc/shadow file indicates the number of days since 1 Jan 1970 that the password was last changed.

deepak@ubuntu:~$ sudo tail -1 /etc/shadow

Why should 1/1/1970 as the epoch time you ask? Read the discussion here.

Unix Time
Coordinated Universal Time

About Deepak Devanand

Seeker of knowledge
This entry was posted in Linux and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s