The year 2020 is significant for Unix: at the beginning of the year original operating system was 50 years old. Unix time, also known as the “date age” is the number of seconds since 1 January 1970. But what bothers the kernel developers in connection with the fiftieth anniversary of Unix?
Although some of the early Unix development preceded the official beginning of his “age”, 1 January 1970 is zero point in time POSIX. Therefore, beginning January 1, 2020, officially the platform was exactly 50 years.
Unix time vs human time
From the point of view of human time, 50 years is a long period. From the point of view of Unix time, there’s nothing special about 50 years, and 43 years would be no less significant. Unix systems (including Linux) store values of date and time as number of seconds since 1970-01-01 00:00:00 UTC, recording in 32 bits. To determine how many seconds have passed since that time and, therefore, the current value of the Unix time, you can run the command:
$ date +%s
Argument %s after the command date displays the current date and time in number of seconds since 1970-01-01.
What is the maximum date that can store Unix system?
To understand how much time it can hold a Unix system, you need to evaluate the capacity of a 32-bit field. It can be calculated as:
$ echo ‘2^32’ | bc
However, since Unix provides for the preservation and negative numbers one bit is reserved for sign, reducing, thus, the time value to:
$ echo ‘2^31’ | bc
And since the Unix numbering starts with 0, it means that we have 2 147 483 648 values, but the biggest is 2 147 483 647 – date and Unix time can’t exceed this number. In the same way as the odometer on the car can not show more than 999,999 miles – add 1, and the value is reset.
How long is a year in seconds?
The number of seconds in a year can be calculated as follows:
$ expr 24 * 60 * 60 * 365
A leap year adds another day:
$ expr 24 * 60 * 60 * 366
How Unix displays his 50th birthday?
January 1, 2020 at 12:00 am is the time 1577836800. The calculation is slightly more complicated because you must account for leap years. Since the beginning of the Unix epoch was 12 years, starting in 1972 and ending in 2016. That is the usual years have passed 38.
Here is the command for expr number of seconds for the past 50 years:
$ expr 24 * 60 * 60 * 365 * 38 + 24 * 60 * 60 * 366 * 12
Or so, with earlier calculations:
$ expr 31536000 * 38 + 31622400 * 12
This method of recording time-made the Unix system is immune to the Y2K problem years where people at the end of 1999 were worried that the transition to the year 2000 may cause damage to computer systems. Difficulties was much less than expected. In fact, the only apps that record years in two-digit format, collided with the reset dates. Many developers have undertaken further work to ensure that their apps will not be affected by the Y2K problem.
When the Unix time will run into problems?
Similar difficulties await a Unix system no earlier than 2038, when the date stored in the format described above, will exceed the 32-bit space. Still 18, but the kernel developers are already working to avoid future failures.
The 2038 problem is sometimes referred to as Y2K38 problem. If it is not resolved till Tuesday 19th of January 2038, after that date, the system may think that you came 1901. One way to solve this problem is to switch to 64-bit representation of date and time. Some believe that it will be much harder than it might seem.
In any case, to panic yet. But the really important today is the 50th anniversary of Unix systems, which are recognized as one of the most important OS in the history.