Summary of machine time, UTC time, local time

Time:2021-9-11

\1. There are two ways to express time, one is human time, such as the year, month, day, etc., and the other is machine time, such as the number of milliseconds obtained by the system. Currenttimemillis() method.
Linux系统
\2. Machine time indicates how much time has passed since the epoch time (0:00:00, January 1, 1970). Note that the time here refers to UTC time.

\3. For any given machine time, the UTC time corresponding to the machine time can be calculated by adding epoch time, that is, the machine time and UTC time are one-to-one corresponding.

\4. When machine time is 0, its corresponding UTC time is epoch time.

\5. Machine time can be understood as another form of UTC time, which is essentially UTC time.

\6. Human time is a way to express machine time in a way that is easy for human to understand. When we see a human time expressed in year, month, day, etc., it is actually a transformation of machine time.

\7. Since the machine can only obtain machine time, all human time is actually obtained by obtaining machine time first and then doing various calculations on its basis.

\8. UTC time is a kind of human time, so to obtain the UTC time of the current time, you must first obtain the machine time, and then calculate it according to the above rules.

\9. UTC time is not affected by time zone. For a given UTC time, it represents the same time anywhere in the world.

\10. UTC time can also be roughly understood as time zone 0.

\11. Due to the relationship between machine time and UTC time, machine time is not affected by time zone, that is, a machine time obtained by system. Currenttimemillis() method also represents the same time anywhere in the world.

\12. Another form of human time is local time, or local time zone time.

\13. The relationship between local time and UTC time is that local time is obtained by adding and subtracting a certain time based on UTC time, and the specific value of addition and subtraction is affected by the time zone.

\14. For example, China’s time zone is East 8. The process to calculate the local time in China is to first obtain the machine time, calculate the UTC time according to the machine time, and then add 8 hours to the UTC time to calculate the local time in China.

\15. Because UTC time is not suitable for representing local time in all regions of the world (for example, 14:00 UTC time may be night in some regions), the concept of local time zone time comes into being. Different time zones use different local time at the same time, which is essentially to facilitate people’s daily life.

\16. If there is only one local time and there is no time zone corresponding to the time, it cannot represent a time on the timeline. Therefore, when time exchange is carried out in different regions of the world, either UTC time or local time with time zone shall be used.

\17. Both UTC time and local time zone time are human time, that is, they can be converted to machine time through certain rules. The difference is that different human time forms use different conversion rules.

\18. I think so much for the time being. If there are other summaries in the follow-up, we will add them.

The above isLiangxu tutorial networkSummary of machine time, UTC time and local time shared by all friends.

This article is composed of blog one article multi posting platformOpenWriterelease!