Time: Difference between revisions
Line 3: | Line 3: | ||
==Standard Time== | ==Standard Time== | ||
''Standard time'' is the synchronization of clocks within a time zone to a single time | ''Standard time'' is the synchronization of clocks within a time zone to a single time value, rather than using solar time or local mean time standard. All clocks within the same timezone show the same time. | ||
The standard time set in each time zone is defined in terms of offsets from [[#UTC|UTC]] and, in those time zones where daylight saving time is observed, by applying an additional offset corresponding to the daylight saving. | The standard time set in each time zone is defined in terms of offsets from [[#UTC|UTC]] and, in those time zones where daylight saving time is observed, by applying an additional offset corresponding to the daylight saving. |
Revision as of 20:49, 13 July 2016
Definitions
Standard Time
Standard time is the synchronization of clocks within a time zone to a single time value, rather than using solar time or local mean time standard. All clocks within the same timezone show the same time.
The standard time set in each time zone is defined in terms of offsets from UTC and, in those time zones where daylight saving time is observed, by applying an additional offset corresponding to the daylight saving.
More details: https://en.wikipedia.org/wiki/Standard_time
UTC
UTC (Coordinated Universal Time or Universal Time) is the primary time standard by which the world regulates time. UTC represents a moment in time within about 1 second of mean solar time at 0° longitude. UTC is an atomic timescale that approximates UT1. It is a successor to GMT (Greenwich Mean Time). For most practical purposes, UTC is considered interchangeable with GMT, but GMT is no longer precisely defined by the scientific community.
Time zones around the world are expressed using positive or negative offsets from UTC.
UTC does not observe daylight savings time. The actual wall clock time in a time zone is obtained by applying the UTC offset and the daylight saving offset, if daylight saving time is in effect in the timezone.
More details: https://en.wikipedia.org/wiki/Universal_Time
UT1
UT1 is the principal form of Universal Time. It conceptually mean solar time at 0° longitude. However, precise measurements of the Sun are difficult. Hence, it is computed from observations of distant quasars using long baseline interferometry, laser ranging of the Moon and artificial satellites, as well as the determination of GPS satellite orbits.
GMT
See UTC
Time Zone
A time zone is a region that observes the same standard time. Most of the time zones are identified by offsets from UTC. The actual wall clock time in a time zone is calculating by applying the time zone offset to UTC and, if daylight time is observed and it is effect, the daylight time offset.
The valid offsets from UTC range from UTC−12 to UTC+14. Most offset values are whole hours, but there are a few that include offset by 30 or 45 minutes.
"Z" is the zone designator for the zero UTC offset.
Offsets from UTC are written in the format ±[hh]:[mm], ±[hh][mm], or ±[hh]: hour(s) ahead or behind UTC. So if the time being described is one hour ahead of UTC (such as the time in Berlin during the winter), the zone designator would be "+01:00", "+0100", or simply "+01". The offset from UTC changes with daylight saving time, e.g. a time offset in Chicago, which is in the North American Central Time Zone, would be "−06:00" for the winter (Central Standard Time) and "−05:00" for the summer.
For more details see: https://en.wikipedia.org/wiki/Time_zone
Time Offset
A time offset is an amount of time subtracted from or added to UTC to get the current wall clock time – whether it's standard time or daylight saving time.
Daylight Saving Time
More details: https://en.wikipedia.org/wiki/Daylight_saving_time
How Do Applications Get the Local Time Zone Information?
Applications obtain the current timezone from the system via the localtime API (for more details see man localtime). The timezone information used by localtime and exposed to the API clients is initialized based on the value of the TZ environment variable, as it follows (this applies to Mac/BSD, update it for other platforms):
- If TZ does not appear in the environment, the best available approximation to local wall clock time is read from /etc/localtime.
- If TZ appears in the environment but its value is a null string, Coordinated Universal Time (UTC) is used.
- If TZ appears in the environment and its value begins with a colon (`:'), the rest of its value is used as a pathname of a tzfile-format file from which to read the time conversion information. If the first character of the pathname is a slash (`/'), it is used as an absolute pathname; otherwise, it is used as a pathname relative to the system time conversion information directory.
- If TZ appears in the environment and its value does not begin with a colon, it is first used as the pathname of a file, as described above, from which to read the time conversion information. Conventionally, the files are available under /usr/share/zoneinfo and the file name designates the corresponding timezone. If that file cannot be read, the value is then interpreted as a direct specification of the time conversion information.
- If the TZ environment variable does not specify a tzfile-format file and cannot be interpreted as a direct specification, UTC is used.
Example
Setting TZ to:
export TZ=/usr/share/zoneinfo/Pacific/Honolulu
causes date to output this:
Tue Jul 12 14:32:47 HST 2016
Java Timezone Support
UTC
UTC is specified as "0000" in RFC 822
15/01/01 01:01:01+0000
and as "Z" in ISO 8601
15/01/01 01:01:01 Z