-
Notifications
You must be signed in to change notification settings - Fork 4
/
183.txt
910 lines (644 loc) · 35.1 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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
[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年以前) は、環境や文脈によっては扱えないことがあります。
最近は多くの環境が[[負]]の値も扱えるようになっているようです。
* 特殊値
[72] [CODE[mktime]] や [CODE[time][time()]] は算出不能時に値 [N[-1]]
を返します。
[70] [TIME[1970年][year:1970]]を扱う必要がない場合に、値 [N[0]]
が「[[日時]]指定なし」など特別な意味を割り当てられることがあります。
* 秒未満
[37] [CODE[time_t]] は[[整数]]とするのが普通ですが、
それ以外では拡張して[[秒未満]]も含めた[DFN[小数のUnix time]]
を使うことがよくあります。
* 閏秒
[15] [[閏秒]]は考えません。
[SEE[ [[閏秒のない時刻系]] ]]
[67]
[[POSIX]] は1[[日]]の[[秒]]数を固定長としつつ、
実際の[[時刻]]との対応は[[未定義]]、[[実装定義]]とし
[SRC[>>10]]、[[閏秒]]の処置は曖昧にしています。
[[実装]]は [[leap smear]] などにより[[閏秒]]が存在しないものとして扱っています。
;; [38] [CODE[tm]] は[[閏秒]]を表現できることになっていますが、
[[Unix time]] で表現できないため有名無実となっています。
[69] [CODE[right/]] のような [[Unix]] システムで[[閏秒]]を扱う試みもありましたが、
[[Unix time]] との整合性を維持できず失敗しました。
* 時間帯
[83]
[[Unix time]] は [[UTC]] での [[Unix epoch]] からの経過時間を表しています。
[84]
どこのどんな[[地方時]] ([[標準時]]、[[サマータイム]])
を使っていて、それが [[UTC]] どどれだけの[[時差]]があるのであっても、
その[[時差情報][時差の記述]]は [[Unix time]]
に含めることはできません。
[[Unix time]] はどの瞬間であるかだけを表します。
[EG[
[85]
[[Unix time]]
[TIME[123456789]]
は、
[TIME[UTC の1973年11月29日21時33分9秒][1973-11-29T21:33:09Z]]を表します。
すなわち
[TIME[日本時間の昭和48(1973)年11月30日6時33分9秒][1973-11-29T21:33:09Z]]です。
]EG]
[86] [[時差]]に意味がある場合は、 [[Unix time]] とは別の方法で保持しなければなりません。
* 各言語・プロトコルの Unix time
** C と POSIX
[6] [[C言語]]は[[データ型]] ([CODE[typedef]]) [DFN[time_t]] を有しています [SRC[>>65]]。
[[ISO C]] はその値の精度や[[値域]]を定めていません [SRC[>>65]] が、
現在では[[実質]]すべての実装が [[POSIX]] の定める [DFN[Epoch][Unix Epoch]] すなわち
[TIME[1970年1月1日0時0分0秒 UTC][1970-01-01T00:00:00Z]] [SRC[>>18]] からの経過[[秒]]数
([DFN[Seconds Since the Epoch]]) [SRC[>>10]] の[[整数]]としています。
1970年未満については[[未定義]]としています [SRC[>>10]]。
伝統的には[[32ビット符号なし整数]]でしたが、
[[2038年問題]]があり[[64ビット符号なし整数]]への移行が進んでいます [SRC[>>66]]。
[68]
[[C言語]]は更に[[構造体]] [DFN[[CODE[timespec]]]]
を定めています。 [CODE[timespec]] は
[[非負]]の [CODE[time_t]] の値を持つ [DFN[[CODE[tv_sec]]]] と、
[ [N[0]], [N[999999999]] ] の [CODE[long]] 値を持つ [DFN[[CODE[tv_nsec]]]]
の組で構成されます。[[ナノ秒]]精度の[[時刻]]の表現に使われます。 [SRC[>>65]]
[SEE[ これらを使う他の関数は [CODE[time.t]] ]]
-*-*-
[11]
[[Perlにおける日時]]は[[プラットフォーム]]依存ですが、
ほとんどすべての場合 [[Unix time]] です。
場合によって[[小数]]の [[Unix time]] も使われます。
[SEE[ [[Perlにおける日時]] ]]
[71]
[[Ruby]] の [CODE[Time][Time (Ruby)]] は [[Unix time]]
を使っています。[[値域]]は[[プラットフォーム]]依存です。
[SEE[ [CODE[Time][Time (Ruby)]] ]]
[REFS[
- [65] [CITE[ISO/IEC 9899:yyyy - n2310.pdf]] ([TIME[2018-11-12 09:13:34 +09:00]]) <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2310.pdf#page=287>
- [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>
-- 移転: [CITE[General Concepts]] ([TIME[2019-04-16 19:09:46 +09:00]]) <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_16>
- [66] [CITE@ja-jp[time_t ‐ 通信用語の基礎知識]] ([TIME[2019-04-16 19:04:11 +09:00]]) <https://www.wdic.org/w/TECH/time_t>
]REFS]
[74] [CITE@en[[[RFC 2783]] - Pulse-Per-Second API for UNIX-like Operating Systems, Version 1.0]], [TIME[2021-04-11T13:49:49.000Z]], [TIME[2021-04-12T08:41:36.180Z]] <https://tools.ietf.org/html/rfc2783#section-2>
** NFS
[114] [[NFS]] の [DFN[[CODE[timeval]]]], [DFN[[CODE[nfstime3]]]]
は、
[[Unix time]] の [DFN[[F[[CODE[seconds]]]]]]
と[[ミリ秒]]数の [DFN[[F[[CODE[useconds]]]]]]
の[[構造体]]です。
[SRC[>>113]]
[REFS[
- [113] [CITE@en[[[RFC 1094]] - NFS: Network File System Protocol specification]], [TIME[2021-01-31T15:59:44.000Z]], [TIME[2021-03-12T08:54:59.902Z]] <https://tools.ietf.org/html/rfc1094#section-2.3.4>
- [115] [CITE@en[[[RFC 1813]] - NFS Version 3 Protocol Specification]], [TIME[2021-01-31T15:58:26.000Z]], [TIME[2021-03-12T09:00:10.197Z]] <https://tools.ietf.org/html/rfc1813#page-21>
]REFS]
** gzip
[55] [[gzip]] の [[MTIME]] は、 [[Unix time]] を[[小エンディアン]]の
4バイト[[符号無し整数]]で表したものです。
[56] ただし、[N[0]] は[[タイムスタンプ]]なしを表します。
** ext ファイルシステムのタイムスタンプ
[SEE[ [[extの日時形式]] ]]
** 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''']]) ともしています。
** SQL
[31] [[SQL]] では[[時間帯を持たない日時]]の[[データ型]]が使われることも多いですが、
その場合でも [[Unix time]] が使われることがあります。ここでの [[Unix time]]
は、本来の [TIME[1970年1月1日0時 UTC][0]] からの[[秒数]]ではなく、
[[地方時]]の[TIME[0時][00:00:00]]からの[[秒数]]とされています。
[20] [[MySQL]] では、 [CODE[UNIX_TIMESTAMP]] で[[日時]]を [[Unix time]] に、
[CODE[FROM_UNIXTIME]] で [[Unix time]] を[[日時]]に変換できます。
;; [32] [[SQLの日時形式]]も参照。
** OAuth の時刻
[2] [CODE(URI)@en[[[oauth_timestamp]]]] も [[Unix time]] 同等の定義となっています。
** 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]
** VMS の時刻
[SEE[ [[VMSの日時形式]] ]]
** MessagePack Timestamp extension type
[116]
[[MessagePack]]
は、
[DFN[Timestamp extension type]]
を定めています。
[[ビット長]]の異なる3種類があります。
[SRC[>>82]]
- [118] [DFN[timestamp 96 format]] - [[秒]] [[32ビット符号なし整数]]
- [119] [DFN[timestamp 64 format]] - [[秒]] [[34ビット符号なし整数]], [[ナノ秒]] [[30ビット符号なし整数]]
- [120] [DFN[timestamp 32 format]] - [[秒]] [[64ビット符号'''付き'''整数]], [[ナノ秒]] [[32ビット符号なし整数]]
[117] [[秒]]はいずれも [[Unix time]]。[[ナノ秒]]は [0, 999999999]。
[[仕様書]]に符号化・復号の方法が定められていますが、
[[ナノ秒]]に不正な値が与えられた時の検査は何もされていません。
[SRC[>>82]]
これは意図したものであるようですが [SRC[>>121]]、
その意図は不明です。
実装が厳密に検査するか否か、[[秒]]と[[秒未満]]を分けて保持するかどうかで、
挙動が変わってきそうで、
[[相互運用性]]・[[セキュリティー]]等の問題の温床にならないか懸念されます。
[REFS[
- [81] [CITE@ja[MessagePackフォーマット仕様にTimestamp型を追加 - Blog by Sadayuki Furuhashi]] ([TIME[2019-09-27 10:27:34 +09:00]]) <http://frsyuki.hatenablog.com/entry/2017/08/10/144310>
-
[82] [CITE@en[msgpack/spec.md at master · msgpack/msgpack]] ([TIME[2019-09-27 20:33:37 +09:00]]) <https://github.com/msgpack/msgpack/blob/master/spec.md#timestamp-extension-type>
- [121] [CITE@en[Proposal for timestamp type by frsyuki · Pull Request #209 · msgpack/msgpack · GitHub]], [TIME[2021-04-09T06:35:49.000Z]] <https://github.com/msgpack/msgpack/pull/209>
]REFS]
** CBOR
[FIG(quote)[
[FIGCAPTION[
[58] [CITE@en[Concise Binary Object Representation (CBOR)]]
([TIME[2018-02-23 07:30:37 +09:00]])
<https://cbor-wg.github.io/CBORbis/#datetimesect>
(消滅確認 [TIME[2021-04-09T06:46:30.200Z]])
]FIGCAPTION]
> Tag value 1 is for numerical representation of seconds relative to 1970-01-01T00:00Z in UTC time. (For the non-negative values that the Portable Operating System Interface (POSIX) defines, the number of seconds is counted in the same way as for POSIX “seconds since the epoch” '''['''TIME_T''']'''.) The tagged item can be a positive or negative integer (major types 0 and 1), or a floating-point number (major type 7 with additional information 25, 26, or 27). Note that the number can be negative (time before 1970-01-01T00:00Z) and, if a floating-point number, indicate fractional seconds.
]FIG]
[FIG(quote)[
[FIGCAPTION[
[43] [CITE@en[RFC 7049 - Concise Binary Object Representation (CBOR)]]
([TIME[2017-05-07 16:11:09 +09:00]])
<https://tools.ietf.org/html/rfc7049#section-2.4.1>
]FIGCAPTION]
> Tag value 1 is for numerical representation of seconds relative to
> 1970-01-01T00:00Z in UTC time. (For the non-negative values that the
> Portable Operating System Interface (POSIX) defines, the number of
> seconds is counted in the same way as for POSIX "seconds since the
> epoch" '''['''TIME_T''']'''.) The tagged item can be a positive or negative
> integer (major types 0 and 1), or a floating-point number (major type
> 7 with additional information 25, 26, or 27). Note that the number
> can be negative (time before 1970-01-01T00:00Z) and, if a floating-
> point number, indicate fractional seconds.
]FIG]
** SGML, XML
[111] [[DSSSL]]:
[[JIS X 4153:1998]] 8.5.11
「[L[1970年1月1日午前0時0分0秒 (GMT) から経過した秒数を整数として]]」
[122] [[XFDLの日時処理]]
* [DFN[Java時刻]]、[DFN[JavaScript時刻]]
[14] [[Java]] の [CODE[Calendar]] [SRC[>>27]] や
[[JavaScript]] の [CODE(JS)@en[[[Date]]]] の値も [[Unix time]]
と同じ[[元期]]ですが、[[ミリ秒]][[単位]]となっています。 (こちらも[[閏秒]]は考えません。)
[24] [[DOM]] の[[日時]]を扱う [[API]] ([CODE[DOMTimeStamp]]) も、
[[ミリ秒]]単位の千倍 [[Unix time]] を用いています。
;; [45] [[JavaScriptの日時形式]]も参照。
[46]
[[DateTime Wire Format]] でも使われています。
[REFS[
[FIG(quote)[
[FIGCAPTION[
[97]
[CITE@en-US[Push API]], [TIME[2020-02-04 16:21:34 +09:00]] <https://w3c.github.io/push-api/#dfn-subscription-expiration-time>
]FIGCAPTION]
>time, in milliseconds since 00:00:00 UTC on 1 January 1970
[SEE[ [[購読満期時刻]] ]]
]FIG]
[FIG(quote)[
[FIGCAPTION[
[27] [CITE@en[Calendar (Java Platform SE 7 )]]
([TIME[2014-02-20 11:18:28 +09:00]])
<http://docs.oracle.com/javase/jp/7/api/java/util/Calendar.html>
]FIGCAPTION]
> 特定の時点は、1970 年 1 月 1 日 00:00:00.000 GMT (グレゴリオ暦) を元期とするミリ秒単位のオフセットで表現できます。
]FIG]
]REFS]
* [DFN[Go時刻]]
[34] [[Go]] の [DFN[[CODE[Time][Time (Go)]]]] は、[[ナノ秒]]単位の [[Unix time]]
を用いています。
[REFS[
[FIG(quote)[
[FIGCAPTION[
[33] [CITE[time - The Go Programming Language]]
([TIME[2017-03-10 18:17:34 +09:00]])
<https://golang.org/pkg/time/#Time>
]FIGCAPTION]
> The zero value of type Time is January 1, year 1, 00:00:00.000000000 UTC.
]FIG]
]REFS]
* epoch days
[100]
[[tantek]]
は[[短縮URL]]
で
[[Unix epoch]]
からの経過[[日]]数を
[[New Base 60]]
で記述し、
[DFN[epoch days]]
と呼んでいます。
[SRC[>>101]]
[EG[
[102]
[CODE[4432]]
は[TIME[2010-02-03]]を表します。
[SRC[>>101]]
]EG]
[REFS[
[FIG(quote)[
[FIGCAPTION[
[101] [CITE[[[tantek]] / Whistle]], [TIME[2020-10-02T06:54:32.000Z]] <http://tantek.pbworks.com/w/page/21743973/Whistle>
]FIGCAPTION]
>After that I use a 3 digit sexagesimal (Base60) number to represent the date in a manner deliberately limited to human individuals. Why Base60? Lots of reasons, including print-safety (as mentioned above). Want to read the entire derivation and reasons why? See [[NewBase60]] (includes open source CASSIS implementation).
>
Why 3 sexagesimal digits to represent the date? It turns out that 3 sexagesimal digits are capable of representing over 500 years of days - plenty overengineered for any human lifetime. And if anyone does figure out how to live more than 500 years I have a feeling that person will not only not resemble human as we know it very much, but will either have bigger problems to deal with than URL shortener limitations, or will be so smart that they will come up with a better solution.
>
But for now, for our feeble less than 200 year lifetimes, this is good enough. In addition we can even agree on a day zero that computes well with existing platforms. Unix Epoch start: 1970-01-01. Given that no-one published anything to the web before 1990, I think we're ok with that. What happens in a few hundred years? Perhaps people can pick their own day zeroes as they see fit.
>
Thus the 3 characters after the "t" represent the number of days since 1970-01-01 in sexagesimal - what I'm calling "epoch days".
]FIG]
]REFS]
* 桁溢れ問題
[59]
[DFN[2038年問題]]は、
[[Unix time]]
の[[桁溢れ問題]]です。
[75] [TIME[2004-02-11 00:45:51 +00:00]] ''[[名無しさん]]'': ''スラッシュドット ジャパン | 2038年問題、早くも顕在化'' <http://slashdot.jp/article.pl?sid=04/02/03/031211&topic=80>
[76] [CITE['''['''tz''']''' DST ends 2040 in Oracle database]]
([TIME[2019-01-26 06:59:55 +09:00]])
<https://mm.icann.org/pipermail/tz/2019-January/027438.html>
[77] [CITE@ja[Y2038ProofnessDesign - glibc wiki]]
([TIME[2019-03-04 16:06:52 +09:00]])
<https://sourceware.org/glibc/wiki/Y2038ProofnessDesign>
[99] [CITE@ja[John Feminella 🌠さんはTwitterを使っています 「⏲️ As of today, we have about eighteen years to go until the Y2038 problem occurs. But the Y2038 problem will be giving us headaches long, long before 2038 arrives. I'd like to tell you a story about this.」 / Twitter]], [TIME[2020-07-31 11:57:52 +09:00]] <https://twitter.com/jxxf/status/1219009308438024200>
* 関連
[47]
[[PTP]] の[[元期]]も同じく[TIME[1970年1月1日0時][1970-01-01T00:00:00]]ですが、
[[TAI]] を使っているので [[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>
[FIG(quote)[
[FIGCAPTION[
[26] [CITE@ja[電子機器の時刻]]
([TIME[2017-01-09 16:22:34 +09:00]])
<http://www.ffortune.net/calen/calen/etime.htm>
]FIGCAPTION]
> 2001年9月9日1時46分40秒にこの数字が十進数で9桁から10桁に変わりました。2chなどではこの数字を掲示板のidに使用しているため、この前後での掲示板の並べ替えがうまく行きません。
]FIG]
[FIG(quote)[
[FIGCAPTION[
[28] ([TIME[2001-11-11 14:06:55 +09:00]])
<http://cr.yp.to/proto/utctai.html>
]FIGCAPTION]
> What is the epoch? Originally it was defined as the beginning of 1970 GMT. GMT, Greenwich Mean Time, is a traditional term for the time zone in England. Unfortunately, it is ambiguous; it can refer to a variety of astronomical time scales.
> Arthur David Olson's popular time library uses an epoch of 1970-01-01 00:00:10 TAI.
]FIG]
[FIG(quote)[
[FIGCAPTION[
[29] [CITE[perlvms - search.cpan.org]]
([TIME[2017-02-13 00:40:55 +09:00]])
<http://search.cpan.org/dist/perl/pod/perlvms.pod#time>
]FIGCAPTION]
> The value returned by time is the offset in seconds from 01-JAN-1970 00:00:00 (just like the CRTL's times() routine), in order to make life easier for code coming in from the POSIX/Unix world.
]FIG]
[30] [CITE@en[File API]]
([TIME[2017-02-11 03:25:10 +09:00]])
<https://w3c.github.io/FileAPI/#UnixEpoch>
[FIG(quote)[
[FIGCAPTION[
[35] [CITE[time - The Go Programming Language]]
([TIME[2017-03-10 18:22:09 +09:00]])
<https://golang.org/pkg/time/#Time.UnixNano>
]FIGCAPTION]
> UnixNano returns t as a Unix time, the number of nanoseconds elapsed since January 1, 1970 UTC.
]FIG]
[36] [CITE@en[SANS Digital Forensics and Incident Response Blog | Understanding EXT4 (Part 2): Timestamps | SANS Institute]]
([TIME[2017-03-10 19:07:34 +09:00]])
<https://digital-forensics.sans.org/blog/2011/03/14/digital-forensics-understanding-ext4-part-2-timestamps>
[39] [CITE@en[Add PushSubscription.expirationTime (#248)]]
([[beverloo]]著, [TIME[2017-04-19 02:15:13 +09:00]])
<https://github.com/w3c/push-api/commit/73da6411aac80de7de9bf5e65ee8eb4cc6a9aa24>
[40] [CITE@en[Epoch (astronomy) - Wikipedia]]
([TIME[2017-05-08 07:11:20 +09:00]])
<https://en.wikipedia.org/wiki/Epoch_(astronomy)>
[41] [CITE[General Concepts]]
([TIME[2017-05-15 17:06:25 +09:00]])
<http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_16>
[FIG(quote)[
[FIGCAPTION[
[42] [CITE@en[RFC 7519 - JSON Web Token (JWT)]]
([TIME[2017-05-14 16:14:20 +09:00]])
<https://tools.ietf.org/html/rfc7519#section-2>
]FIGCAPTION]
> NumericDate
> A JSON numeric value representing the number of seconds from
> 1970-01-01T00:00:00Z UTC until the specified UTC date/time,
> ignoring leap seconds. This is equivalent to the IEEE Std 1003.1,
> 2013 Edition '''['''POSIX.1''']''' definition "Seconds Since the Epoch", in
> which each day is accounted for by exactly 86400 seconds, other
> than that non-integer values can be represented.
]FIG]
[FIG(quote)[
[FIGCAPTION[
[44] [CITE@en[レシートのフィールド]]
([TIME[2017-05-18 00:39:47 +09:00]])
<https://developer.apple.com/jp/documentation/General/ValidateAppStoreReceipt/Chapters/ReceiptFields.html>
]FIGCAPTION]
> 定期購読の有効期限が、1970年1月1日 00:00:00 GMTからのミリ秒単位で表されています。
> ASN.1フィールドタイプ:1708
> ASN.1フィールド値: IA5STRING(RFC 3339の日付として解釈されます)
> JSONフィールド名:expires_date
> JSONフィールド値:数値
]FIG]
[FIG(quote)[
[FIGCAPTION[
[48] [CITE@ja[プログラマーの常識をJavaで身につける(4):OSとプログラミングの「時間」に関する常識 (1/3) - @IT]]
([TIME[2017-06-08 18:49:20 +09:00]])
<http://www.atmarkit.co.jp/ait/articles/0703/28/news135.html>
]FIGCAPTION]
> 具体的には、1970年1月1日 00:00:00 GMTからのミリ秒数を表すlong値として表現されています。この原稿では、これを便宜的に「エポックからのミリ秒」と呼ぶことにします。なお、1970年1月1日 00:00:00 GMTについてJava言語APIでは、「エポック」と呼んでいます。
]FIG]
[FIG(quote)[
[FIGCAPTION[
[49] [CITE[日付関数またはタイムスタンプ関数の日付部分 - Amazon Redshift]]
([TIME[2017-06-08 07:42:07 +09:00]])
<http://docs.aws.amazon.com/ja_jp/redshift/latest/dg/r_Dateparts_for_datetime_functions.html>
]FIGCAPTION]
> Amazon Redshift の EPOCH の実装は、サーバーのあるタイムゾーンから独立した 1970-01-01 00:00:00.000000 に関連します。
]FIG]
[FIG(quote)[
[FIGCAPTION[
[50] [CITE@ja-jp[タイムスタンプ型 | CQL for Cassandra 2.x]]
([TIME[2017-05-23 01:28:12 +09:00]])
<https://docs.datastax.com/ja/cql-jajp/3.1/cql/cql_reference/timestamp_type_r.html>
]FIGCAPTION]
> タイムスタンプ型の値は64ビットの符号付き整数としてエンコードされ、エポックとして知られる標準基準時間(1970年1月1日、GMT時間0時0分0秒)からのミリ秒数を表します。
]FIG]
[FIG(quote)[
[FIGCAPTION[
[51] [CITE@en[GitHub API v3 | GitHub Developer Guide]]
([TIME[2017-06-10 05:53:45 +09:00]])
<https://developer.github.com/v3/#rate-limiting>
]FIGCAPTION]
> The time at which the current rate limit window resets in UTC epoch seconds.
]FIG]
[FIG(quote)[
[FIGCAPTION[
[52] [CITE@en[docker service logs | Docker Documentation]]
([TIME[2017-06-10 10:22:13 +09:00]])
<https://docs.docker.com/engine/reference/commandline/service_logs/#extended-description>
]FIGCAPTION]
> When providing Unix timestamps enter seconds'''['''.nanoseconds''']''', where seconds is the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap seconds (aka Unix epoch or Unix time), and the optional .nanoseconds field is a fraction of a second no more than nine digits long.
]FIG]
[FIG(quote)[
[FIGCAPTION[
[53] [CITE[取引所APIドキュメント | Coincheck(コインチェック)]]
([TIME[2017-06-22 11:12:30 +09:00]])
<https://coincheck.com/ja/documents/exchange/api>
]FIGCAPTION]
> ACCESS-NONCE 毎リクエストごとに増加する必要のある正の整数。通常はUNIXタイムスタンプを用います。最大値は 9223372036854775807 です。APIキーごとに管理されます。
]FIG]
[54] [CITE@en[Make Event's timeStamp use DOMHighResTimeStamp]]
([[majido]]著, [TIME[2017-07-13 16:38:55 +09:00]])
<https://github.com/whatwg/dom/commit/912d58746bc4c67c2fd210124639f7c34991fce5>
[FIG(quote)[
[FIGCAPTION[
[57] [CITE@en[Git - git-commit Documentation]]
([TIME[2018-03-04 14:30:18 +09:00]])
<https://git-scm.com/docs/git-commit#_date_formats>
]FIGCAPTION]
> Git internal format
> It is <unix timestamp> <time zone offset>, where <unix timestamp> is the number of seconds since the UNIX epoch. <time zone offset> is a positive or negative offset from UTC. For example CET (which is 1 hour ahead of UTC) is +0100.
]FIG]
[60] [CITE@en[Unix time - Wikipedia]]
([TIME[2018-09-29 18:11:15 +09:00]])
<https://en.wikipedia.org/wiki/Unix_time>
[FIG(quote)[
[FIGCAPTION[
[61] [CITE[LHA解説書]]
([TIME[2012-10-06 14:39:51 +09:00]])
<http://techno7.co.jp/jimuki/new2000/lha/index.htm>
]FIGCAPTION]
> LHA では内部的にタイムスタンプを 1970-01-01 00:00:00 UTC からの通算秒
に変換しています。このため、実在しないスタンプ(80-00-00 など)を持った
ファイルを格納した場合、タイムスタンプは不定となります。
]FIG]
[62] しかし保存先は [[MS-DOSの日時形式]]らしい。
[FIG(quote)[
[FIGCAPTION[
[63] [CITE@ja-jp[LHAフォーマット ‐ 通信用語の基礎知識]]
([TIME[2018-10-14 01:39:52 +09:00]])
<https://www.wdic.org/w/TECH/LHA%E3%83%95%E3%82%A9%E3%83%BC%E3%83%9E%E3%83%83%E3%83%88>
]FIGCAPTION]
> 03h DWORD 最終更新日時 (time_t形式)
>
]FIG]
[FIG(quote)[
[FIGCAPTION[
[64] [CITE[gzip-1.9 released '''['''stable''']''']]
([TIME[2018-01-08 08:44:44 +09:00]])
<https://lists.gnu.org/archive/html/info-gnu/2018-01/msg00004.html>
]FIGCAPTION]
> When converting from system-dependent time_t format to the 32-bit
> unsigned MTIME format used in gzip files, if a timestamp does not
> fit gzip now substitutes zero instead of the timestamp's low-order
> 32 bits, as per Internet RFC 1952. When converting from MTIME to
> time_t format, if a timestamp does not fit gzip now warns and
> substitutes the nearest in-range value instead of crashing or
> silently substituting an implementation-defined value (typically,
> the timestamp's low-order bits). This affects timestamps before
> 1970 and after 2106, and timestamps after 2038 on platforms with
> 32-bit signed time_t. '''['''bug present since the beginning''']'''
]FIG]
[73] [CITE@en[msgpack/spec.md at master · msgpack/msgpack]]
([TIME[2019-07-14 10:38:22 +09:00]])
<https://github.com/msgpack/msgpack/blob/master/spec.md#timestamp-extension-type>
[78] [CITE@ja[第25回 32ビット環境に迫る「2038年問題」 時計がおかしくなると…… (1/3) - ITmedia エンタープライズ]]
([TIME[2019-07-29 12:07:37 +09:00]])
<https://www.itmedia.co.jp/enterprise/articles/1607/13/news020.html>
[79] [CITE@ja[KDDI、「2038年問題」で1346万円を過剰請求 - ITmedia NEWS]]
([TIME[2019-07-29 12:09:47 +09:00]])
<https://www.itmedia.co.jp/news/articles/0403/08/news023.html>
[80] [CITE@en[Package google.protobuf | Protocol Buffers | Google Developers]]
([TIME[2019-06-20 23:04:44 +09:00]])
<https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Timestamp>
[87] [CITE[9月 9日 コンピュータの9月9日問題が発生(2001年)(ブルーバックス編集部) | ブルーバックス | 講談社]]
([TIME[2019-11-10 09:37:51 +09:00]])
<https://gendai.ismedia.jp/articles/-/66915>
[88] [CITE@ar[上原 哲太郎/Tetsu. Uehara على تويتر: "いまいち認知が広がらない2038年問題ですが、Siriは知っています。Siriに世界の終わりを聞くとこう答えることがあります。… "]]
(午前7:57 · 2018年9月26日 [TIME[2019-11-15 11:12:53 +09:00]])
<https://twitter.com/tetsutalow/status/1044722692576829440>
[FIG(quote)[
[FIGCAPTION[
[89] [CITE@ja[KDDI、「2038年問題」で1346万円を過剰請求 - ITmedia NEWS]]
(2004年03月08日 16時56分 公開 [TIME[2020-01-02 22:08:40 +09:00]])
<https://www.itmedia.co.jp/news/articles/0403/08/news023.html>
]FIGCAPTION]
> 2004年03月08日 16時56分 公開
]FIG]
[FIG(quote)[
[FIGCAPTION[
[90] [CITE[VRML97, ISO/IEC 14772-1:1997 -- 3 Definitions]]
([TIME[2014-01-31 07:20:50 +09:00]])
<https://www.web3d.org/documents/specifications/14772/V2.0/part1/glossary.html#Time>
]FIGCAPTION]
> 3.99 time
> A monotonically increasing value generated by a node. Time (0.0) starts at 00:00:00 GMT January 1, 1970.
]FIG]
[FIG(quote)[
[FIGCAPTION[
[91] [CITE[VRML97, ISO/IEC 14772-1:1997 -- 4 Concepts]]
([TIME[2014-01-31 07:20:50 +09:00]])
<https://www.web3d.org/documents/specifications/14772/V2.0/part1/concepts.html#4.11>
]FIGCAPTION]
> Time (0.0) is equivalent to 00:00:00 GMT January 1, 1970. Absolute times are specified in SFTime or MFTime fields as double-precision floating point numbers representing seconds. Negative absolute times are interpreted as happening before 1970.
]FIG]
[92] [CITE[VRML97, ISO/IEC 14772-1:1997 -- 5 Field and Event Reference]]
([TIME[2014-01-31 07:20:50 +09:00]])
<https://www.web3d.org/documents/specifications/14772/V2.0/part1/fieldsRef.html#SFTime>
[93] [CITE[LKML: Arnd Bergmann: '''['''GIT PULL''']''' y2038: core, driver and file system changes]]
([TIME[2020-02-03 06:58:46 +09:00]])
<https://lkml.org/lkml/2020/1/29/355>
[94] [CITE@ja[2038年問題に対応した「OpenBSD 5.5」リリース | OSDN Magazine]]
([TIME[2020-02-05 18:32:38 +09:00]])
<https://mag.osdn.jp/14/05/02/160000>
[95] [CITE@ja[OpenBSD 5.5、2038年問題に対応 | スラド オープンソース]]
([TIME[2020-02-05 18:32:45 +09:00]])
<https://opensource.srad.jp/story/14/05/06/1839242/>
[FIG(quote)[
[FIGCAPTION[
[96] [CITE[Ink Markup Language (InkML)]]
([TIME[2018-10-09 22:24:24 +09:00]])
<https://www.w3.org/TR/2011/REC-InkML-20110920/#timestamp>
]FIGCAPTION]
> time = xsd:decimal
> The absolute time for this timestamp, in milliseconds since 1 January 1970 00:00:00 UTC.
> Required: no, Default: none.
]FIG]
[FIG(quote)[
[FIGCAPTION[
[98] [CITE@ja[SORACOM API 利用ガイド | SORACOM Users]]
([TIME[2020-03-26 00:33:24 +09:00]])
<https://dev.soracom.io/jp/docs/api_guide/#datetime>
]FIGCAPTION]
> API パラメータでは、UNIX Time(1970年1月1日からの経過秒数)を指定する箇所と、YYYYMMDD のようなフォーマットの文字列形式で指定する箇所がありますが、いずれも UTC で指定します。
]FIG]
[FIG(quote)[
[FIGCAPTION[
[103] [CITE['''['''GIT PULL''']''' xfs: new code for 5.10, part 1 - Darrick J. Wong]]
([TIME[2020-10-20T09:05:45.000Z]])
<https://lore.kernel.org/lkml/20201014205059.GD9837@magnolia/>
]FIGCAPTION]
>
> - New feature: Widen inode timestamps and quota grace expiration
> timestamps to support dates through the year 2486.
> [SNIP[]]
> xfs: widen ondisk inode timestamps to deal with y2038+
> xfs: widen ondisk quota expiration timestamps to handle y2038+
> xfs: trace timestamp limits
> xfs: enable big timestamps
]FIG]
[104] [CITE@en[Linux 5.10 to make Year 2038 problem the Year 2486 problem • The Register]]
([TIME[2020-10-20T09:06:23.000Z]])
<https://www.theregister.com/2020/10/19/linux_5_10_y2k38_fixes/>
[105] [CITE@en[XFS File-System With Linux 5.10 Punts Year 2038 Problem To The Year 2486 - Phoronix]]
([TIME[2020-10-20T09:06:35.000Z]])
<https://www.phoronix.com/scan.php?page=news_item&px=XFS-Linux-5.10>
[106] [CITE@ja[Linuxカーネル5.6、32ビット版で2038年問題への対応が行われる | スラド Linux]]
([TIME[2020-10-20T09:07:30.000Z]])
<https://linux.srad.jp/story/20/02/05/1249244/>
[107] [CITE@en[Pondering 2038 '''['''LWN.net''']''']]
([TIME[2013-08-29T09:22:51.000Z]], [TIME[2020-10-20T09:10:07.535Z]])
<https://lwn.net/Articles/563285/>
[108] [CITE@en[Linux 5.6 Is The First Kernel For 32-Bit Systems Ready To Run Past Year 2038 - Phoronix]]
([TIME[2020-10-20T09:10:30.000Z]])
<https://www.phoronix.com/scan.php?page=news_item&px=Linux-5.6-32-bit-Past-Y2038>
[109] [CITE@ja[Linuxカーネル5.10、XFSファイルシステムの2038年問題に対処 | スラド Linux]]
([TIME[2020-10-20T09:10:49.000Z]])
<https://linux.srad.jp/story/20/10/19/194204/>
[110] [CITE@en[GNU Coreutils: 28.9 Unix 紀元 (the Epoch) からの秒数]]
([TIME[2019-09-09T03:33:16.000Z]], [TIME[2020-10-20T09:12:42.541Z]])
<https://linuxjm.osdn.jp/info/GNU_coreutils/coreutils-ja_207.html>
[112] [CITE@ja[Arthur David OlsonさんはTwitterを使っています 「It's Salute to the Seventies day at the @SSTransitCenter. Guess: a UNIX-derived computer operating on UTC drives this display and crashed 17 minutes before I captured this image. https://t.co/G3b12GQDue https://t.co/9Ze5qUN5ME」 / Twitter]]
(午前4:22 · 2021年2月2日 [TZ[+09:00]], [TIME[2021-02-01T12:13:06.000Z]])
<https://twitter.com/dashdashado/status/1356321947005628418>
[FIG(quote)[
[FIGCAPTION[
[123] [CITE@ja[第66回 モジュールによる時間の多様な取り扱い(1):Perl Hackers Hub|gihyo.jp … 技術評論社]]
([TIME[2021-04-19T00:15:00.000Z]], [TIME[2021-04-19T11:29:21.509Z]])
<https://gihyo.jp/dev/serial/01/perl-hackers-hub/006601>
]FIGCAPTION]
> UNIX時間は,例外的にClassic Mac OSなど一部の古いシステムでは,UTC1904年1月1日00:00:00が紀元になることがあります。
]FIG]