部署在50多个国家的200多个原子时钟的平均值 TAI-UT1大约是1958年1月1日
Defined by the Earth's rotation (GPS satellites used) UT0完全按照天体运行计算出来的时间 UT1在UT0上做了调整 UT2在UT0和UT1上做了调整
UTC - Universal Time Coordinated 协调世界时 在0经度(本初子午线)的时间 精度为“秒“ 基于原子时钟 时间是均匀的 UTC源自1972年 “闰秒”保证与UT1误差不超过0.9秒 (UT1 - UTC = DUT1,DUT1 is maintained via leap seconds)
GMT - Greenwich Mean Time 格林威治时间 What UTC used to be called(UTC定义了世界标准时间,1972年以前,GMT就是世界标准时间)
UTC + 时区差 = 本地时间
时区差 东为正,西为负
08 Nov 2010 10:42:22 +800 本地时间为2010年11月08日10点42分22秒,本地时间领先UTC八个小时
Measured as the number of seconds since 1970.1.1 UTC
Timezone is a presentation-layer problem! Most of your code should not deal with timezone or local time, it should use unix time.
Avoid re-implement stuff about timezone convension or formatting, use your language built-in function.
When recording a point in time, use Unix time, it's UTC.
When storing a timestamp, store unix time, it's a single number.
If trying to store human-readable time, consider store it along with unix time, not instead of unix time
When display time, always include the timezone offset. A time format without offset is useless.
The system clock is inaccurate. On a nework? Every other system's clock is differently inaccurate.
The system clock can/will jump backwards and forward. Your program should survive this.
ntpd
can change the system time in two ways:
..* Step: correct time directly
..* Slew: changing the frequency of the clock so that it slowly drifts toward the correct time (GOOD!)
MYSQL
(4.x/5.x at least) stores DATETIME
type as YYYY-MM-DD HH:MM:SS
string, no offset. Use UNIX_TIMESTAMP()
and FROM_UNIXTIME()
to store as integer
How to present an exactly accurate a time
- Unix time: long, all OS/lib supports it
- +: e.g. 2014-10-20T11:39:33.556+800
http://www.joda.org/joda-time/cal_gregorian.html
Used by the modern business world.
Introduced on 1582-10-15, to replace Julian calendar.
Can NOT be used to describe date time before 1583.
The Gregorian chronology in Joda-Time is equivalent* to the ISO chronology, and uses Gregorian rules for all time. The difference is "century", e.g. 2005 in Gregorian is 21st century, but in ISO is 20, since ISO defines a century as the first two digits of the year.