Log in Sign up
Back to Discover
💻

Unix time

technology Maturity 7-9 war conflict
This article covers sensitive topics: war_conflict. Parents can manage visibility in Parental Controls.

Computers use a special way to tell time.

1000000000seconds.jpg
1000000000seconds.jpg
They count every second since a long time ago. This helps them work together. It helps them stay on track. It is very smart! Do you like to count?

38 words

Computers use a special way to tell time.

1000000000seconds.jpg
1000000000seconds.jpg
They count every second that passes. They start counting from a special day in 1970. This is called the epoch.
Year 2038 problem.gif
Year 2038 problem.gif
This counting helps computers work together. It helps them keep track of files. It also helps them use different programs. Every day has the same number of seconds. This makes it easy for them to count. It is a very helpful tool for technology.

76 words

Computers use a special way to track time. This system is called Unix time. It counts every second that passes. The count starts at a fixed point. This starting point is called the Unix epoch. The epoch was midnight on January 1, 1970.

1000000000seconds.jpg
1000000000seconds.jpg

Unix time is used in many ways. It helps computer systems work together. It is also used in databases. Some computers use even smaller units. They might count microseconds or nanoseconds.

Most days have exactly 86,400 seconds. However, sometimes a leap second is added. A leap second helps keep time in sync with the Earth. When this happens, Unix time can act strangely. It might repeat a number or jump.

Many systems use a 32-bit integer to store this number. An integer is a whole number. A 32-bit limit only covers about 136 years. This leads to the Year 2038 problem.

Year 2038 problem.gif
Year 2038 problem.gif

On some systems, the time will overflow in 2038. This means the number gets too big for the space. Experts work to fix this for new technology.

175 words

Computers need a very precise way to track time. They often use a system called Unix time. This system measures time by counting seconds. It counts how many seconds have passed since a specific starting point. This starting point is called the Unix epoch. The epoch is midnight on January 1, 1970.

1000000000seconds.jpg
1000000000seconds.jpg
This method is used in many computer systems. It works in operating systems and databases. It even works in programming languages. Some modern computers use even smaller units. They might track microseconds or nanoseconds to be even more exact.

Unix time works by adding one to a number for every second. The number starts at zero at the epoch. If you look at a time before 1970, the number is negative. For example, midnight on January 1, 1969, would be a negative value. To turn this number back into a normal date, computers use math. They divide the number to find the days passed. Then they use the remainder to find the seconds in that day. This helps turn a long string of numbers into a date we recognize.

Unix time began as the system for Unix operating systems. It was created to help those computers keep track of time. Over many years, it became a standard for many other things. It is now used in many different types of computer technology. People even held parties to celebrate big milestones in Unix time. For example, a group in Copenhagen, Denmark, held a party in 2001. They celebrated when the count reached a very large number.

1000000000seconds.jpg
1000000000seconds.jpg

Most days have exactly 86,400 seconds. However, things get tricky with leap seconds. A leap second is a tiny adjustment to keep clocks in sync with the Earth. Coordinated Universal Time, or UTC, uses these seconds. Unix time handles them in a unique way. In Unix time, every day must have exactly 86,400 seconds. When a leap second happens, the Unix time number might jump or repeat. This can cause a small break in how the numbers flow.

Year 2038 problem.gif
Year 2038 problem.gif

Many older systems store this time as a 32-bit signed integer. An integer is just a whole number. A 32-bit limit means the number cannot grow forever. It can only count for a certain amount of time. This creates something called the Year 2038 problem. On these systems, the number will get too big in the year 2038. This is known as an overflow. It is similar to how an old car odometer might roll back to zero.

Year 2038 problem.gif
Year 2038 problem.gif

421 words

Unix time is a digital method for representing dates and times. It is used widely across computer operating systems, file systems, and databases. Instead of using months or days, it tracks time by counting seconds. Specifically, it measures the number of non-leap seconds that have passed since a fixed starting point. This starting point is known as the Unix epoch. The epoch is defined as 00:00:00 UTC on Thursday, 1 January 1970.

1000000000seconds.jpg
1000000000seconds.jpg

The mechanism of Unix time is a continuous count. At the exact moment of the epoch, the value is zero. For every non-leap second that passes, the number increases by one. For example, at midnight on 1 January 2010, the Unix time was 1262304000. If a system supports negative values, it can represent times before 1970. For instance, midnight on 1 January 1969 would be represented by a negative integer. To convert these large numbers back into human-readable dates, computers use math. They divide the number by 86,400 to find the number of days passed. The remainder of that division shows the seconds passed since midnight UTC on that day.

Unix time handles time differently than other systems like Coordinated Universal Time (UTC) or International Atomic Time (TAI). UTC includes leap seconds to stay in sync with solar time. Solar time relates to the Earth's position relative to the sun. TAI uses precise atomic clocks and ignores solar time. Because TAI does not adjust for Earth's rotation, it loses about one second per year compared to solar time. However, Unix time ignores these adjustments. In the Unix system, every single day consists of exactly 86,400 seconds. This creates a unique relationship with the way the Earth actually rotates.

This difference leads to complications when a leap second occurs. A leap second is an extra second added to UTC to keep clocks accurate. Because Unix time insists that every day has exactly 86,400 seconds, it cannot simply add a new second to the count. Instead, the Unix time number experiences a discontinuity. During a positive leap second, which happens about every 18 months on average, the Unix time number might jump or repeat. On some systems, the time number increases continuously and then jumps back by one at the end of the leap second. This can make the time ambiguous, as a single number might refer to two different moments in UTC.

There are different ways to implement a Unix clock. One common method is the Network Time Protocol (NTP) variant. This is a non-synchronous version that does not strictly follow the POSIX standard. It uses a "Mills-style" approach to handle leap seconds. In this system, the time number might actually decrease momentarily where a leap should have occurred. It then leaps to the correct time one second later. This method is often easier to implement in computer networks. To decode this correctly, a programmer must look at a "leap second state variable" alongside the time number. This variable tells the system whether the leap has already happened.

Another rare variant exists that actually counts leap seconds. Some Linux systems can be configured to increment the value for every second, including leap seconds. This version is more like TAI. In this system, every day is a pure 86,400 seconds long without any jumps. This makes calculating the time between two points much easier because the math is linear. However, this version is not technically standard Unix time. To turn these numbers into UTC, you must consult a specific table of leap seconds. This is similar to how people use time zone tables to convert local time.

One major technical concern involves how the numbers are stored. Many older systems store Unix time as a 32-bit signed integer. A signed 32-bit integer has a specific limit on how large the number can grow. This limit covers about 68 years before and after the 1970 epoch. Because of this limit, computers will face the "Year 2038 problem."

Year 2038 problem.gif
Year 2038 problem.gif
As the count approaches the end of 2038, the number will exceed the capacity of a 32-bit integer. This causes an overflow, where the number rolls over. This is a significant issue for any system relying on older 32-bit architecture.

Unix time remains a fundamental part of modern computing infrastructure. Even though it has flaws regarding leap seconds, its simplicity makes it very efficient for computers to process. Most modern applications now use higher granularity to be even more precise. They may store time in microseconds or nanoseconds rather than just seconds. This allows for much more detailed tracking of events in fast digital systems. By understanding the epoch and the way these numbers increment, scientists and engineers can manage the complex timing required for global technology.

787 words
🖼️ Images & Media (2)
File:1000000000seconds.jpg
1000000000seconds.jpg
File:Year 2038 problem.gif
Year 2038 problem.gif
Up Next
💻
System time
Technology
More to explore

🔬 Go deeper

More advanced topics to explore

🪜 Step back

Simpler topics to build understanding

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.