[23] Unix time は、 Unix 系システムを中心に多くの計算機システムで用いられている日時の内部表現形式 (整数時刻系) です。 計算機システム用の時刻系としては最も著名なものです。
[25] Unix time は、 元期1970年1月1日0時0分0秒 (UTC) (Unix epoch、The Epoch) から経過した秒単位の時間を数として表したものです。
[7] 負の値 (1969年以前) は、環境や文脈によっては扱えないことがあります。 最近は多くの環境が負の値も扱えるようになっているようです。
[37] time_t
は整数とするのが普通ですが、
それ以外では拡張して秒未満も含めた小数のUnix time
を使うことがよくあります。
[67] POSIX は1日の秒数を固定長としつつ、 実際の時刻との対応は未定義、実装定義とし >>10、閏秒の処置は曖昧にしています。 実装は leap smear などにより閏秒が存在しないものとして扱っています。
[69] right/
のような Unix システムで閏秒を扱う試みもありましたが、
Unix time との整合性を維持できず失敗しました。
[83] Unix time は UTC での Unix epoch からの経過時間を表しています。
[84] どこのどんな地方時 (標準時、サマータイム) を使っていて、それが UTC どどれだけの時差があるのであっても、 その時差情報は Unix time に含めることはできません。 Unix time はどの瞬間であるかだけを表します。
[6] C言語はデータ型 (typedef
) time_t を有しています >>65。
ISO C はその値の精度や値域を定めていません >>65 が、
現在では実質すべての実装が POSIX の定める Epoch すなわち
>>18 からの経過秒数
(Seconds Since the Epoch) >>10 の整数としています。
1970年未満については未定義としています >>10。
伝統的には32ビット符号なし整数でしたが、
2038年問題があり64ビット符号なし整数への移行が進んでいます >>66。
[68]
C言語は更に構造体 timespec
を定めています。 timespec
は
非負の time_t
の値を持つ tv_sec
と、
[ 0, 999999999 ] の long
値を持つ tv_nsec
の組で構成されます。ナノ秒精度の時刻の表現に使われます。 >>65
time.t
[11]
Perlにおける日時はプラットフォーム依存ですが、
ほとんどすべての場合 Unix time です。
場合によって小数の Unix time も使われます。
[71]
Ruby の Time
は Unix time
を使っています。値域はプラットフォーム依存です。
Time
[74] RFC 2783 - Pulse-Per-Second API for UNIX-like Operating Systems, Version 1.0, , https://tools.ietf.org/html/rfc2783#section-2
[114] NFS の timeval
, nfstime3
は、
Unix time の seconds
とミリ秒数の useconds
の構造体です。
>>113
[55] gzip の MTIME は、 Unix time を小エンディアンの 4バイト符号無し整数で表したものです。
[13]
RFC 4871 が定義する DKIM-Signature:
頭欄の t=
タグの値は、
1970年1月1日0時0分0秒 (UTC) からの秒数とされています。
ただし、閏秒は数えません。 RFC 4871 は、
実装に対して最低 1012 (≒ 紀元後20万年、≒ 40ビット符号無し整数)
までの値を扱えることを推奨 (SHOULD) しています。
更に、サービス拒否攻撃防止のために、
12桁以上の値は無限大とみなして構わない
(MAY) ともしています。
[31] SQL では時間帯を持たない日時のデータ型が使われることも多いですが、 その場合でも Unix time が使われることがあります。ここでの Unix time は、本来の 1970年1月1日0時 UTC からの秒数ではなく、 地方時のからの秒数とされています。
[20] MySQL では、 UNIX_TIMESTAMP
で日時を Unix time に、
FROM_UNIXTIME
で Unix time を日時に変換できます。
[2] oauth_timestamp
も Unix time 同等の定義となっています。
[126] BinaryTime は、 RFC 4049 で規定された ASN.1の日時形式の一種で、 Unix time を使っています。 >>125
[116] MessagePack は、 Timestamp extension type を定めています。 ビット長の異なる3種類があります。 >>82
[117] 秒はいずれも Unix time。ナノ秒は [0, 999999999]。 仕様書に符号化・復号の方法が定められていますが、 ナノ秒に不正な値が与えられた時の検査は何もされていません。 >>82 これは意図したものであるようですが >>121、 その意図は不明です。 実装が厳密に検査するか否か、秒と秒未満を分けて保持するかどうかで、 挙動が変わってきそうで、 相互運用性・セキュリティー等の問題の温床にならないか懸念されます。
[111] DSSSL:
JIS X 4153:1998 8.5.11
「
[141] , http://www.y-adagio.com/public/standards/jis_dsssl/cls8.txt
(time) (time->string k) (time->string k boolean)手続きtimeは,1970年1月1日午前0時0分秒(GMT)から経過した秒数を整数として返す。手続きtime->stringは,手続きtimeが返す日付及び時間の整数表現をISO 8601の形式の文字列に変換する。引数booleanが存在し,それが真の場合,文字列表現はGMTに基づくものとなり,その他の場合に地方時間を示す。
[137] Java などで単位をミリ秒とするミリ秒Unix timeが使われています。
[136] BSON のUTC datetimeがミリ秒Unix time です。 MongoDB Extended JSON の日付の一種もミリ秒Unix timeです。
[14] Java の Calendar
>>27 や
JavaScript の Date
の値も Unix time
と同じ元期ですが、ミリ秒単位となっています。 (こちらも閏秒は考えません。)
[24] DOM の日時を扱う API (DOMTimeStamp
) も、
ミリ秒単位の千倍 Unix time を用いています。
[46] DateTime Wire Format でも使われています。
[138] Go言語などで単位をナノ秒とするナノ秒Unix timeが使われています。
[149] Date nanoseconds field type | Elasticsearch Guide [8.11] | Elastic, , https://www.elastic.co/guide/en/elasticsearch/reference/current/date_nanos.html
The
date_nanos
data type stores dates in nanosecond resolution, which limits its range of dates from roughly 1970 to 2262, as dates are still stored as a long representing nanoseconds since the epoch.
[100] tantek は短縮URL で Unix epoch からの経過日数を New Base 60 で記述し、 epoch days と呼んでいます。 >>101
[150] std::chrono::system_clock - cppreference.com, , https://en.cppreference.com/w/cpp/chrono/system_clock
The epoch of system_clock
is unspecified, but most implementations use Unix Time (i.e., time since 00:00:00 Coordinated Universal Time (UTC), Thursday, 1 January 1970, not counting leap seconds).(until C++20) system_clock
measures Unix Time (i.e., time since 00:00:00 Coordinated Universal Time (UTC), Thursday, 1 January 1970, not counting leap seconds).(since C++20)
[151] >>150
std::chrono::seconds
を使うと秒数になり、
std::chrono::days
を使うと日数になります。
[139] Unix epoch を 0 とするグレゴリオ月単位の数え方: HTML月数
[140] Unix epoch を 0 とする朔望月単位の数え方: 月時計
[144] Unix time の10進表現はに9桁で表現できなくなりました。 前年のの西暦2000年問題に関連して危険日としてよく紹介されていました。 大きな問題は報告されていません。 >>143, >>142
[157] Windows Meに2001年9月9日問題 | スラド, https://srad.jp/story/01/06/12/0626230/
[59] 西暦2038年問題は、 Unix time の桁溢れ問題です。
[76] [tz] DST ends 2040 in Oracle database () https://mm.icann.org/pipermail/tz/2019-January/027438.html
[77] Y2038ProofnessDesign - glibc wiki () https://sourceware.org/glibc/wiki/Y2038ProofnessDesign
[99] 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, https://twitter.com/jxxf/status/1219009308438024200
[133] Investigating why Steam started picking a random font, http://blog.pkh.me/p/35-investigating-why-steam-started-picking-a-random-font.html
[134] >>133 時刻を進めて戻したらおかしなフォントが選ばれるようになった → フォントのタイムスタンプが2038年を超えているために桁溢れのエラーが(!)
[135] たかが時刻でこんな影響が出るなんて誰も思わんよなあw
[145] Year 2038 problem - Wikipedia, , https://en.wikipedia.org/wiki/Year_2038_problem
[146] Time formatting and storage bugs - Wikipedia, , https://en.wikipedia.org/wiki/Time_formatting_and_storage_bugs#Windows_C_runtime_library
[158] GNU C Library Lands Year 2038 Handling For Legacy ABIs - Phoronix, https://www.phoronix.com/news/Glibc-More-Y2038-Work
[148] Time formatting and storage bugs - Wikipedia, , https://en.wikipedia.org/wiki/Time_formatting_and_storage_bugs#Year_2106
Many existing file formats, communications protocols, and application interfaces employ a variant of the Unix
time_t
date format, storing the number of seconds since the Unix Epoch (midnight UTC, 1 January 1970) as an unsigned 32-bit binary integer. This value will roll over on 7 February 2106 at 06:28:15. That is, at this time the number of seconds since 1 January 1970 is FFFF FFFF in hex.
[152] Time formatting and storage bugs - Wikipedia, , https://en.wikipedia.org/wiki/Time_formatting_and_storage_bugs#Year_2286
Systems that use a string of length 10 characters to record the Unix time may have problems reporting times beyond the ten-billionth second after 20 November 2286, at 17:46:40.
[1] スラッシュドット ジャパン | 明日でepochから2^30秒 http://slashdot.jp/article.pl?sid=04/01/08/172200&mode=flat&commentsort=4&threshold=-1
[16] time_t - Wikipedia ( ( 版)) http://ja.wikipedia.org/wiki/Time_t
[17] Unix time - Wikipedia, the free encyclopedia ( ( 版)) http://en.wikipedia.org/wiki/Unix_time
[8] iPhoneを「1970年1月1日」に設定すると利用不能になる問題、Appleがソフト更新で解消へ - ITmedia ニュース ( 版) http://www.itmedia.co.jp/news/articles/1602/16/news132.html
[9] iPhoneで「1970年1月1日」に設定すると使用不能に? 実際に試してみた - ITmedia Mobile ( 版) http://www.itmedia.co.jp/mobile/articles/1602/12/news125.html
[19] WebDriver () https://w3c.github.io/webdriver/webdriver-spec.html#dfn-unix-epoch
[30] File API () https://w3c.github.io/FileAPI/#UnixEpoch
[36] SANS Digital Forensics and Incident Response Blog | Understanding EXT4 (Part 2): Timestamps | SANS Institute () https://digital-forensics.sans.org/blog/2011/03/14/digital-forensics-understanding-ext4-part-2-timestamps
[39] Add PushSubscription.expirationTime (#248) (beverloo著, ) https://github.com/w3c/push-api/commit/73da6411aac80de7de9bf5e65ee8eb4cc6a9aa24
[40] Epoch (astronomy) - Wikipedia () https://en.wikipedia.org/wiki/Epoch_(astronomy)
[41] General Concepts () http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_16
[54] Make Event's timeStamp use DOMHighResTimeStamp (majido著, ) https://github.com/whatwg/dom/commit/912d58746bc4c67c2fd210124639f7c34991fce5
[60] Unix time - Wikipedia () https://en.wikipedia.org/wiki/Unix_time
[62] しかし保存先は MS-DOSの日時形式らしい。
[73] msgpack/spec.md at master · msgpack/msgpack () https://github.com/msgpack/msgpack/blob/master/spec.md#timestamp-extension-type
[78] 第25回 32ビット環境に迫る「2038年問題」 時計がおかしくなると…… (1/3) - ITmedia エンタープライズ () https://www.itmedia.co.jp/enterprise/articles/1607/13/news020.html
[79] KDDI、「2038年問題」で1346万円を過剰請求 - ITmedia NEWS () https://www.itmedia.co.jp/news/articles/0403/08/news023.html
[80] Package google.protobuf | Protocol Buffers | Google Developers () https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Timestamp
[87] 9月 9日 コンピュータの9月9日問題が発生(2001年)(ブルーバックス編集部) | ブルーバックス | 講談社 () https://gendai.ismedia.jp/articles/-/66915
[88] 上原 哲太郎/Tetsu. Uehara على تويتر: "いまいち認知が広がらない2038年問題ですが、Siriは知っています。Siriに世界の終わりを聞くとこう答えることがあります。… " (午前7:57 · 2018年9月26日 ) https://twitter.com/tetsutalow/status/1044722692576829440
[92] VRML97, ISO/IEC 14772-1:1997 -- 5 Field and Event Reference () https://www.web3d.org/documents/specifications/14772/V2.0/part1/fieldsRef.html#SFTime
[93] LKML: Arnd Bergmann: [GIT PULL] y2038: core, driver and file system changes () https://lkml.org/lkml/2020/1/29/355
[94] 2038年問題に対応した「OpenBSD 5.5」リリース | OSDN Magazine () https://mag.osdn.jp/14/05/02/160000
[95] OpenBSD 5.5、2038年問題に対応 | スラド オープンソース () https://opensource.srad.jp/story/14/05/06/1839242/
[104] Linux 5.10 to make Year 2038 problem the Year 2486 problem • The Register () https://www.theregister.com/2020/10/19/linux_5_10_y2k38_fixes/
[105] XFS File-System With Linux 5.10 Punts Year 2038 Problem To The Year 2486 - Phoronix () https://www.phoronix.com/scan.php?page=news_item&px=XFS-Linux-5.10
[106] Linuxカーネル5.6、32ビット版で2038年問題への対応が行われる | スラド Linux () https://linux.srad.jp/story/20/02/05/1249244/
[107] Pondering 2038 [LWN.net] (, ) https://lwn.net/Articles/563285/
[108] Linux 5.6 Is The First Kernel For 32-Bit Systems Ready To Run Past Year 2038 - Phoronix () https://www.phoronix.com/scan.php?page=news_item&px=Linux-5.6-32-bit-Past-Y2038
[109] Linuxカーネル5.10、XFSファイルシステムの2038年問題に対処 | スラド Linux () https://linux.srad.jp/story/20/10/19/194204/
[110] GNU Coreutils: 28.9 Unix 紀元 (the Epoch) からの秒数 (, ) https://linuxjm.osdn.jp/info/GNU_coreutils/coreutils-ja_207.html
[112] 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日 , ) https://twitter.com/dashdashado/status/1356321947005628418
[124] GNU C Library、Y2038対策でレガシーABIに64ビット時刻のサポートが追加 | スラド IT () https://it.srad.jp/story/21/06/17/1724219/
[129] DateTimeOffset.ToUnixTimeMilliseconds メソッド (System) | Microsoft Docs (dotnet-bot, ) https://docs.microsoft.com/ja-jp/dotnet/api/system.datetimeoffset.tounixtimemilliseconds?view=net-6.0#System_DateTimeOffset_ToUnixTimeMilliseconds
[130] 10億秒 | スラド () https://srad.jp/story/01/09/08/1027223/
[132] xssbnuny (furdu soon?)さんはTwitterを使っています: 「Boss: your leave request broke the system Me: uh sigh Boss: why do you want to take the specific week off in 2038 Me: for this exact reason」 / Twitter (, ) https://twitter.com/xssfox/status/1514493425248522245
tm
は閏秒を表現できることになっていますが、 Unix time で表現できないため有名無実となっています。