1. What is Unix Time?
Unix time is total number of seconds measured since 01-Jan-1970 00:00:00. This time format is used in all the Unix flavors for time computing activities such as dates associated with files/inodes, etc. This date , 1-Jan-1970 00:00:00 is also called epoch date.
2. How to find the Unix time ?
The date command with %s option :
$ date '+%s' 1357906744
This number is the total number of seconds elapsed since 01-Jan-1970 till now.
3. Can we calculate the Unix time for a specific date time?
Yes, using the -d option (available in GNU date ).
To get the timestamp for the date time which is 2 days ago:
$ date -d "2 days ago" '+%s' 1334141505To get the Unix time for a specific date : 1-Feb-2012 10 hours 25 mins 15 secs:
$ date -d "2010-02-01 10:25:15 " '+%s' 12650001154. Is it possible to calculate the date time from Unix time?
Yes, it is possible using the -d option.
$ date -d@1334141505 Wed Apr 11 16:21:45 IST 20125. What is the Year 2038 problem?
This Unix time is stored in a structure which is 32 bit. Using a 32 bit structure, time can be provided for a defined period beyond which the number cannot be stored in a 32 bit structure and hence will start overflowing. This period is identified as to be falling on 19 January 2038. Beyond this date, Unix time will start showing past dates due to the negative value resulting in overflow. Hence, after 19 Jan 2038, this time cannot be stored and hence the year 2038 problem. However, systems with 64 bit structure to store the time will not get affected by this.
For detailed references:
1. Wiki Unix Time
2. Why is 1-1-1970 the epoch time?
3. Year 2038 problem
No comments:
Post a Comment