This is a brief note to organize the currently known timestamp counting standards for different computer systems.

The question of how to express time is an ancient one. In the West, the year of Jesus’ birth was widely used as the “Gregorian calendar”, while in ancient China, people used the “Heavenly Stems and Earthly Branches” method of chronology, using a combination of the ten Heavenly Stems and twelve Earthly Branches, cycling once every sixty years. In modern times, there is also the “Huangdi Era”, which starts from the year of the reign of Emperor Huang, and the “Republic of China Era”, which starts from 1912.

People often use an important historical moment as a starting point to calculate time backwards or forwards. This is true in life and also in computer systems. Here are some of the timestamp standards used in different computer systems.

### UNIX Time Stamp

The UNIX Time Stamp is the total number of seconds elapsed from 00:00:00 UTC on January 01, 1970 to the present time, regardless of leap seconds. UNIX timestamps are positive for time after 1970 and negative for time before 1970. In earlier computer systems, because of the use of 32-bit data to store UNIX timestamps, the Y2038 problem will likely occur: i.e., on January 19, 2038 at 03:14:07, the lower 31 bits of the 32-bit data representing the timestamp will be fully filled resulting in a bit feed to the sign bit, at which point the system time will jump back to 1970 or 1901.

#### Why do we count from 1970?

The first version of UNIX system was introduced in 1970. At that time, the operating system was 32-bit, and an int could store the exact time to the second, which could represent about 68.1 years at most, and this storage range was obviously not enough if we counted from the first year of the year AD. At the earliest, people even intended to start from 1971, but finally, the UNIX timestamp was calculated from 1970 after considering the storage range and the convenience of memory.

### GPS Time

GPS time (GPST), an atomic time reference consisting of GPS satellite-based atomic clocks and ground monitoring station atomic clocks, starts at zero hour on January 6, 1980. The corresponding BeiDou Time (BDT), the time reference used by the BeiDou satellite navigation system, has a starting time of 00:00 on January 1, 2006.

### Operating system time

Taking the iOS operating system as an example, the time used by system APIs such as NSDate is based on January 1, 2001 at 00:00, a time that differs from the UTC timestamp by 978307200 seconds, which is where the NSTimeIntervalSince1970 definition comes from:

 ``````1 `````` ``````#define NSTimeIntervalSince1970 978307200.0 ``````

For most scenarios, the conversion to UNIX timestamps is uniform for ease of calculation, and developers hardly need to pay much attention to the differences between systems.