


International Atomic Time (TAI), in which every day is precisely 86 400 seconds long, ignores solar time and gradually loses synchronization with the Earth's rotation at a rate of roughly one second per year. UTC includes leap seconds that adjust for the discrepancy between precise time, as measured by atomic clocks, and solar time, relating to the position of the earth in relation to the sun. Unix time differs from both Coordinated Universal Time (UTC) and International Atomic Time (TAI) in its handling of leap seconds. This can be misleading since Unix time is not the only time system based on an epoch and the Unix epoch is not the only epoch used by other time systems. Unix time is sometimes referred to as Epoch time. Every day in Unix time consists of exactly 86 400 seconds. For example, 00:00:00 UTC on 1 January 1969 is represented in Unix time as −31 536 000. Negative values indicate times before the Unix epoch, with the value decreasing by 1 for every non-leap second before the epoch. For example, 00:00:00 UTC on 1 January 1971 is represented in Unix time as 31 536 000. The Unix time 0 is exactly midnight UTC on 1 January 1970, with Unix time incrementing by 1 for every non-leap second after this. Unix time is typically encoded as a signed integer. Unix time is currently defined as the number of seconds which have passed since 00:00:00 UTC on Thursday, 1 January 1970, which is referred to as the Unix epoch. It has come to be widely used in other computer operating systems, file systems, programming languages, and databases. Unix time originated as the system time of Unix operating systems. In modern computing, values are sometimes stored with higher granularity, such as microseconds or nanoseconds. It measures time by the number of seconds that have elapsed since 00:00:00 UTC on 1 January 1970, the Unix epoch, without adjustments made due to leap seconds. Unix time is a date and time representation widely used in computing. It was celebrated in Copenhagen, Denmark at a party held by the Danish UNIX User Group at 03:46:40 local time.
#LINUX TIME CONVERTER FREE#
This Perl program is free for you to use (open source), so customize it, change the date and time format, etc.Unix time passed 1 000 000 000 seconds on. I use printf to print the output in a nice format.I make adjust the $year and $month to again make them more human readable.I use the localtime method to convert the epoch time into six separate variables.To make the program a little easier to understand I create the variable $epoch_time.Since there must be only one command line argument, the next thing I do is die if the number of arguments does not equal 1.I use the special Perl $#ARGV variable to determine how many command line arguments there are.If you're an experienced Perl programmer this script isn't too hard to decipher. ($sec,$min,$hour,$day,$month,$year) = localtime($epoch_time) # a perl script to convert Nagios "epoch time" (epoch seconds)ĭie "Usage: this-program epochtime (something like '1219822177')" if
#LINUX TIME CONVERTER CODE#
Given that introduction, here is the source code for my Perl script: (Maybe a computer can't read that time format very well, but a human can read it pretty easily.) My epoch time converting Perl script To help me read these date/time records I created a simple Perl date-conversion program I named. If you can read the epoch time format and know the actual human readable date and time, you're a better person than I am (or you've been looking at Nagios, Linux, or Unix log files too long). If you're ever read that log file, or looked at some other Linux/Unix log files, you've seen records that display the time in an epoch time format, which looks like this: I had to work with Nagios a lot this morning, in particular reading through the nagios.log log file.
