Search

# What is Epoch Time? Unix Epoch Time, Advantages, Problems (Year 2038)

Time is an important concept both for humans as well as computers for actual time keeping (a wall clock in our homes or system clock in computers) and mathematical calculations (such as velocity, which is distance over time). Computers deal with 1’s and 0’s and it is essential to properly represent time. As we need a starting pointing of reference for time in computers i.e., amount of time that has passed since this reference point, Epoch is starting point for UNIX systems. But what is Epoch Time? What is the Epoch for different Operating Systems? We will explore more about epoch in this guide.

Outline

## What is Epoch Time?

Let us kick-off with the important question: What is Epoch Time? In the world of computers, Epoch is the starting point (date and time) from which they measure the system time.

Epoch is the zero point for a computer’s time i.e., it represents the 00 hours, 00 minutes and 00 seconds. Different operating systems have different epoch times.

For instance, in UNIX and POSIX based operating systems, the epoch time is 00:00:00 UTC, Thursday 1st January 1970. Computers based on UNIX measure time by counting the number of seconds that passed (minus the leap seconds) from this point. Hence, this Epoch time is also known as Unix Epoch Time (or simple Epoch Time, Unix Time, POSIX Time).

Developers of Unix Ken Thompson and Dennis Ritchie are also responsible for setting the epoch date and time as 1st January, 1970 and 00:00:00.

## Need for Epoch

If you observe the epoch time representation, it is just a count of number of seconds starting from Unix Epoch Time. We are essentially using numbers to represent date, day and time.

The main benefit of such representation is that you can easily perform mathematical operations such as addition and subtraction on numbers and effortlessly calculate date and time.

For example, every 60 epoch seconds is equal to 1 actual minute and 3,600 epoch seconds is nothing but an hour in real life.

You can get a clear idea from the following table of count of epoch second and its equivalent time period in real life.

 Epoch Seconds Count Real Life Time Elapsed 1 1 Second 60 1 Minute 3,600 1 Hour 86,400 1 Day (24 Hours) 604,800 1 Week 1,209,600 2 Weeks 1,814,400 3 Weeks 2,419,200 1 Month (28 days) 2,592,000 30 Days 14,515,200 6 Months (168 Days) 29,030,400 1 Year (336 Days) 290,304,000 1 Decade (3360 Days)

So, if the difference between two epoch counts is, say 10,800, for example, then we can say that 3 hours has passed between those two events.

## What is Epoch Time in Other Operating Systems?

Is the Epoch Date and Time same for all the computers in the World? The answer is no. Epoch Time is Operating System dependent and different operating systems have different epoch times. What we saw in the introduction section is just the epoch for UNIX and POSIX systems.

Other operating systems such as Windows, MacOS etc. have respective epoch times. You can take a look at the following table for understanding the epoch times of each major operating system.

 Operating System Epoch Date (Starting) Epoch Date (End) UNIX 1st January, 1970 19th January, 2038 POSIX 1st January, 1970 19th January, 2038 DOS, Microsoft DOS, IBM OS/2 1st January, 1980 1st January, 2108 Microsoft Windows (Windows NT) 1st January, 1601 Year 30828 Linux 1st January, 1970 19th January, 2038 Apple macOS (Classic) 1st January 1904 6th February, 2040 macOS 1st January, 1970 19th January, 2038 AmigaOS 1st January, 1978 – S/390 1st January, 1970 19th January, 2038

Apart from operating system, certain applications also have their own epoch dates. You can take a look some major applications and software along with their epoch date down in the table.

 Application / Software Epoch Date MATLAB 0 January, 1 BC Microsoft Excel 0 January, 1900 Microsoft .NET 1st January, 1 AD GPS (Global Positioning System) 6th January, 1980 LibreOffice 30th December, 1899 LabVIEW 1st January, 1904 Apple Cocoa Framework 1st January, 2001 Programming Languages (C, C++, Python, Ruby, Java, JavaScript, Tcl, etc.) 1st January, 1970

An important point here is that when we say the system counts the number of seconds from the epoch time, it is specific to an operating system. In general, it is actually the number of ‘ticks’ the system counts and each tick is different in different operating systems.

 Operating System Epoch Tick UNIX 1 sec POSIX 1 sec DOS, Microsoft DOS, IBM OS/2 1 sec Microsoft Windows (Windows NT) 100 ns Linux 1s Apple macOS (Classic) 1 sec macOS 1 sec S/390 244.14 ps

## How Effective is Unix Epoch? Problems with Unix Epoch Time

While representing date and time as numbers has its benefits, it also has its problems. In most operating systems, we store the epoch count as a 32-bit signed integer. So, the maximum value it can represent is 231 – 1.

Coming to the Unix Epoch, as it started on 1st of January, 1970 at 00:00:00, the maximum date and time we can store is 03:14:07 UTC, 19th January 2038. The next count will cause an integer overflow and rolls back the date and time to 20:45:52 UTC, 13th December, 1901.

This problem is famously known as the Year 2038 Problem (as it is similar to the Year 2000 Problem).

Many Unix and other major operating systems moved from signed 32-bit integers to signed 64-bit integers to represent the epoch count. But if you have a legacy system that do not support 64-bit computing or an embedded system that cannot be updated, then the problem of Year 2038 is persistent in them.

## Conclusion

Representing date and time in computers is an important part of its operation. System Time acts as a point of reference to many tasks and applications in all computing systems. Epoch is the starting point from which a computer system calculates the system time. In Unix, Epoch is 00:00:00 UTC, 1st of January, 1970. Other operating systems have their own epoch times. This guide answers the important question of what is epoch time and why do we need it. We also saw the epoch time for some popular operating systems and applications.