-
Notifications
You must be signed in to change notification settings - Fork 4
/
183.txt
179 lines (124 loc) · 6.2 KB
/
183.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
[23] [DFN[Unix time]] は、 [[Unix]] 系システムを中心に多くの[[計算機システム]]で用いられている[[日時]]の内部表現形式です。
[[計算機システム]]用の[[時刻系]]としては最も著名なものです。
* 意味
[25] [[Unix time]] は、
[TIME[1970年1月1日0時0分0秒 (UTC)][0]] ([DFN[Unix epoch]]、[DFN[The Epoch]])
から経過した[[秒]]単位の[[時間]]を[[数]]として表したものです。
* 負
[7] [[負]]の値 (1969年以前) は、環境や文脈によっては扱えないことがあります。
最近は多くの環境が[[負]]の値も扱えるようになっているようです。
* 閏秒
[15] [[閏秒]]は考えません。
;; [[閏秒のない時刻系]]参照。
* 各言語・プロトコルの Unix time
** C と POSIX
[6] [[C]] には [DFN[time_t]] [[型]]があり、普通 [[Unix time]] を表すものとして扱われています。
[11] [[Perl]] は [CODE[time]] などで[[システム]]の[[時刻]]を使っており、
ほとんどの[[システム]]で [[Unix time]] です。 [[Unix time]]
は [[Perl]] [[アプリケーション]]の標準の内部時刻形式と考えられています。
[REFS[
- [18] [CITE[Definitions]]
( ([TIME[2014-05-13 04:24:34 +09:00]] 版))
<http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_150>
- [10] [CITE[General Concepts]]
([TIME[2016-04-26 12:24:41 +09:00]] 版)
<http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_15>
]REFS]
** PGP の時刻
[FIG(quote)[
[FIGCAPTION[
[5] [CITE@en[RFC 4880 - OpenPGP Message Format]]
([TIME[2015-04-05 14:41:03 +09:00]] 版)
<https://tools.ietf.org/html/rfc4880#section-3.5>
]FIGCAPTION]
> A time field is an unsigned four-octet number containing the number
of seconds elapsed since midnight, 1 January 1970 UTC.
]FIG]
** DKIM の時刻
[13]
[[RFC 4871]] が定義する [CODE(822)@en[[[DKIM-Signature]]:]]
[[頭欄]]の [CODE(822)@en[[[t]]=]] [[タグ]]の値は、
1970年1月1日0時0分0秒 ([[UTC]]) からの[[秒]]数とされています。
ただし、[[閏秒]]は数えません。 [[RFC 4871]] は、
実装に対して最低 10[SUP[12]] (≒ [[紀元後]]20万年、≒ 40ビット[[符号無し整数]])
までの値を扱えることを[['''推奨''']] ([['''SHOULD''']]) しています。
更に、[[サービス拒否攻撃]]防止のために、
12桁以上の値は[[無限大]]とみなして[['''構わない''']]
([['''MAY''']]) ともしています。
** MySQL の UNIX TIME
[20] [[MySQL]] では、 [CODE[UNIX_TIMESTAMP]] で[[日時]]を [[Unix time]] に、
[CODE[FROM_UNIXTIME]] で [[Unix time]] を[[日時]]に変換できます。
** OAuth の時刻
[2] [CODE(URI)@en[[[oauth_timestamp]]]] も同等の定義となっています。
** OpenID の時刻
[FIG(quote)[
[FIGCAPTION[
[3] [CITE@en[Final: OpenID Connect Core 1.0 incorporating errata set 1]]
([TIME[2014-11-09 04:00:29 +09:00]] 版)
<http://openid.net/specs/openid-connect-core-1_0.html#rfc.section.2>
]FIGCAPTION]
> Its value is a JSON number representing the number of seconds from 1970-01-01T0:0:0Z as measured in UTC until the date/time.
]FIG]
** CDNI の時刻
[FIG(quote)[
[FIGCAPTION[
[21] [CITE@en[RFC 8006 - Content Delivery Network Interconnection (CDNI) Metadata]]
([TIME[2016-12-14 14:55:04 +09:00]])
<https://tools.ietf.org/html/rfc8006#section-4.3.4>
]FIGCAPTION]
> A time value expressed in seconds since the UNIX epoch (i.e., zero
hours, zero minutes, zero seconds, on January 1, 1970) Coordinated
Universal Time (UTC) '''['''POSIX''']'''.
> Type: Integer
> Example time representing 09:00:00 01/01/2000 UTC:
946717200
]FIG]
[FIG(quote)[
[FIGCAPTION[
[22] [CITE@en[RFC 8007 - Content Delivery Network Interconnection (CDNI) Control Interface / Triggers]]
([TIME[2016-12-14 14:58:50 +09:00]])
<https://tools.ietf.org/html/rfc8007#section-5.2.5>
]FIGCAPTION]
> A JSON number, seconds since the UNIX epoch (00:00:00 UTC on
1 January 1970).
]FIG]
** TLS の時刻
[FIG(quote)[
[FIGCAPTION[
[4] [CITE@en[RFC 5246 - The Transport Layer Security (TLS) Protocol Version 1.2]]
([TIME[2015-02-19 08:58:15 +09:00]] 版)
<http://tools.ietf.org/html/rfc5246#section-7.4.1.2>
]FIGCAPTION]
>
:gmt_unix_time:
The current time and date in standard UNIX 32-bit format
(seconds since the midnight starting Jan 1, 1970, UTC, ignoring
leap seconds) according to the sender's internal clock. Clocks
are not required to be set correctly by the basic TLS protocol;
higher-level or application protocols may define additional
requirements. Note that, for historical reasons, the data
element is named using GMT, the predecessor of the current
worldwide time base, UTC.
]FIG]
** JavaScript 時刻
[14] [[JavaScript]] の [CODE(JS)@en[[[Date]]]] の値も [[Unix time]]
と同じ[[紀元]]ですが、[[ミリ秒]]単位となっています。 (こちらも[[閏秒]]は考えません。)
[24] [[DOM]] の[[日時]]を扱う [[API]] ([CODE[DOMTimeStamp]]) も、
[[ミリ秒]]単位の千倍 [[Unix time]] を用いています。
* メモ
[1] ''スラッシュドット ジャパン | 明日でepochから2^30秒'' <http://slashdot.jp/article.pl?sid=04/01/08/172200&mode=flat&commentsort=4&threshold=-1>
[16] [CITE@ja[time_t - Wikipedia]]
( ([TIME[2014-04-22 06:59:21 +09:00]] 版))
<http://ja.wikipedia.org/wiki/Time_t>
[17] [CITE@en[Unix time - Wikipedia, the free encyclopedia]]
( ([TIME[2014-05-11 13:26:43 +09:00]] 版))
<http://en.wikipedia.org/wiki/Unix_time>
[8] [CITE@ja[iPhoneを「1970年1月1日」に設定すると利用不能になる問題、Appleがソフト更新で解消へ - ITmedia ニュース]]
([TIME[2016-02-17 19:58:04 +09:00]] 版)
<http://www.itmedia.co.jp/news/articles/1602/16/news132.html>
[9] [CITE@ja[iPhoneで「1970年1月1日」に設定すると使用不能に? 実際に試してみた - ITmedia Mobile]]
([TIME[2016-02-17 19:59:19 +09:00]] 版)
<http://www.itmedia.co.jp/mobile/articles/1602/12/news125.html>
[19] [CITE@en[WebDriver]]
([TIME[2016-07-22 07:24:31 +09:00]])
<https://w3c.github.io/webdriver/webdriver-spec.html#dfn-unix-epoch>