[14] [DFN[[CODE(IDL)@en[[[DOMTimeStamp]]]]]] は、[[ミリ秒]]数を表す[[型]]です。

* 仕様書

[REFS[
- [11] '''[CITE[Web IDL (Second Edition)]] ([TIME[2015-05-27 01:29:33 +09:00]] 版) <https://heycam.github.io/webidl/#common-DOMTimeStamp>'''
- [23] [CITE@en[DOM Standard]] ([TIME[2016-06-16 16:23:04 +09:00]]) <https://dom.spec.whatwg.org/#dom-event-timestamp>
- [20] [CITE@en[Notifications API Standard]] ([TIME[2016-06-08 23:12:14 +09:00]]) <https://notifications.spec.whatwg.org/#timestamp>
]REFS]

* 意味

[12] [CODE(IDL)@en[[[DOMTimeStamp]]]] は、[[ミリ秒]]数を表します [SRC[[[DOM 2 Core]], [[DOM 3 Core]], >>11]]。

[16] これは[[絶対時刻]]の場合もあれば、[[相対的な時間の量]]のこともあります [SRC[>>11]]。

[13] [CODE(IDL)@en[[[DOMTimeStamp]]]] は、 [CODE(IDL)@en[[[unsigned long long]]]]
を [[typedef]] したものです [SRC[[[DOM 2 Core]], [[DOM 3 Core]], >>11]]。

* 文脈

[5] [CODE(DOMi)@en[Event]] [[インターフェイス]]の [CODE(DOMa)@en[timeStamp]]
[[IDL属性]]では、[TIME[1970年1月1日][0]]からの[[閏秒]]を無視した[[ミリ秒]]数を表します [SRC[>>20]]。

;; [[JavaScript時刻]]参照。

[HISTORY[
[24] [[W3C DOM]] 時代は、かなり曖昧な規定でした。
この属性の値は、紀元からの相対時刻をミリ秒で表現したものです。
[[紀元]]は実装依存 (束縛依存? システム依存?) で、
システム開始時でも1970年1月1日でも何でも良いようです。
[SRC[DOM 2 Events, DOM 3 Events]]

[28] それもあって実装状況はかなり悲惨なようです [SRC[>>27]]。
]HISTORY]

[19] [[通知]]の[F[時刻印][Notification.prototype.timestamp]]
([CODE(DOMi)@en[Notification]] [[オブジェクト]]の [CODE(DOMa)@en[timestamp][Notification.prototype.timestamp]]
[[IDL属性]]、[CODE(DOMi)@en[NotificationOptions]] [[辞書]]の
[CODE(DOMa)@en[timestamp][Notification.prototype.timestamp]] [[メンバー][辞書メンバー]])
では、[TIME[1970年1月1日][0]]からの[[ミリ秒]]数を表します [SRC[>>20]]。

;; [25] [[閏秒]]の規定はありません。意図は無視だと思われますが...

[22] [CODE[webNavigation]] API の [CODE[timeStamp]] [[引数]]は、
[CODE[double]] 型と説明されていますが、
[[epoch]] からの[[ミリ秒]]数を表します [SRC[>>21]]。
実質的に [CODE(DOMi)@en[DOMTimeStamp]] です。

[40] 
[CODE[GeolocationPosition]] で使われます。

[HISTORY[
[34] [CODE(DOMi)@en[SensorReading]] の [CODE(DOMa)@en[timeStamp]] [[IDL属性]]は、
[CODE(DOMi)@en[DOMTimeStamp]] から [CODE(DOMi)@en[DOMHighResTimeStamp]] に変更されました。
]HISTORY]

* 関連

[8] [[HTML]] の [CODE(DOMi)@en[[[HTMLMediaElement]]]] [[界面]]の [CODE(DOMa)@en[[[currentTime]]]]
[[DOM属性]]は、[[媒体]]の[[現在時刻]]を表すものですが、[[型]]は [DEL[[CODE(IDL)@en[float]]]]
[CODE(IDL)@en[double]] であって、 [CODE(DOMi)@en[[[DOMTimeStamp]]]] ではありません。
値も[[秒]]が[[単位]]です。

[26] [CODE(JS)@en[Date]] も参照。

* 歴史

** W3C DOM 時代

[1] [DFN[[CODE(DOM)[DOMTimeStamp]]]] 型は、
相対時刻や絶対時刻を蓄積するために使用します [SRC[DOM 3 Core]]。
この型は相互運用性の向上のために導入されました [SRC[DOM 2 Core]]。

[4] 仕様書:
[REFS[
- [[DOM 2]] Core: 1.1.6. The [CODE(DOM)[DOMTimeStamp]] type
<IW:DOM2:"Core/core.html#Core-DOMTimeStamp">
- [[DOM 3]] Core: 1.2.2 The [CODE(DOM)[DOMTimeStamp]] type
<IW:DOM3:"Core/core.html#Core-DOMTimeStamp">
]REFS]

[2] DOM 束縛は、 [CODE(DOM)[DOMTimeStamp]] に異なる型を使用して構いません
[SRC[DOM 2 Core, DOM 3 Core]]。

:[[Java]]:Java 束縛では、 [CODE(Java)[[[long]]]] 型を使います
[SRC[DOM 2 Core, DOM 3 Core]]。
:[[ECMAScript]]:ECMAScript 束縛では、
([CODE(JS)[[[integer]]]] 型は小さすぎるので) [CODE(JS)[[[Date]]]] 型を使います。
[SRC[DOM 2 Core, DOM 3 Core]]

[3] >>2 [CODE(JS)[Date]] 型は The [[Epoch]] (1970年1月1日)
からの''ミリ''秒数です。

[7]
>>3 しかも閏秒は考えないそうです [SRC[ECMAScript [ABBR[TE] [3[SUP[rd]] Edition]]]]。

[6]
この型は絶対時刻表現につかうことも想定しているみたいですが (>>1)、実際には相対時刻表現にしか使われていません (>>5)。
絶対時刻表現につかうとすると[[閏秒]]などに関する規定が必要になりますが、 DOM 3 までの仕様書には見当たりません。

** Web IDL 時代

[9] [CITE@en[DOMTimeStamp binding]]
([[Kartikaya Gupta]] 著, [TIME[2009-02-12 02:38:29 +09:00]] 版)
<http://lists.w3.org/Archives/Public/public-webapps/2009JanMar/0386.html>

[10] [CITE[Leap seconds are ignored by JavaScript (not clear if implementations fol... · 4ad095c · whatwg/dom]]
( ([TIME[2014-04-11 23:59:00 +09:00]] 版))
<https://github.com/whatwg/dom/commit/4ad095c0e6edc6d358fc0a3ef19e4461bf571c7b>

[15] [CITE@en[Merge pull request #342 from martinthomson/issue324 · w3c/webrtc-pc@05909f7]]
([TIME[2015-10-24 13:19:58 +09:00]] 版)
<https://github.com/w3c/webrtc-pc/commit/05909f7d33c0dca829816c3ca47b93a593fb9fc6>

[17] [CITE@en[1231619 – CSS Animation not properly timed when using AngularJS animate on Firefox Developer edition and nightly]]
([TIME[2015-12-11 02:36:14 +09:00]] 版)
<https://bugzilla.mozilla.org/show_bug.cgi?id=1231619>

[18] [CITE@en[Change the type of `timestamp` to DOMTimeStamp · whatwg/notifications@e234c43]]
([TIME[2016-01-23 12:37:24 +09:00]] 版)
<https://github.com/whatwg/notifications/commit/e234c43b23d180c2a1c88e6ce00815de334cafdd>

[21] [CITE[chrome.webNavigation - Google Chrome]] ([TIME[2016-06-20 10:17:01 +09:00]]) <https://developer.chrome.com/extensions/webNavigation>

[27] [CITE@en[High resolution timing for events · Issue #23 · whatwg/dom]]
( ([TIME[2016-06-20 10:39:45 +09:00]]))
<https://github.com/whatwg/dom/issues/23>

[29] [CITE@en[1231619 – CSS Animation not properly timed when using AngularJS animate on Firefox Developer edition and nightly]]
( ([TIME[2016-06-20 10:50:01 +09:00]]))
<https://bugzilla.mozilla.org/show_bug.cgi?id=1231619>

[30] [CITE@en-CA[event.timeStamp now returns DOMHighResTimeStamp on Nightly/Aurora for Linux (Affected) | Firefox Site Compatibility]]
( ([TIME[2016-06-20 01:03:12 +09:00]]))
<https://www.fxsitecompat.com/en-CA/docs/2015/event-timestamp-now-returns-domhighrestimestamp-on-nightly-aurora-for-linux/>

[31] [CITE@en[77992 – Make Event.timeStamp return a DOMHighResTimeStamp on Windows (was Event.timeStamp should be relative to 1st January 1970 rather than the system start)]]
( ([TIME[2016-06-20 11:29:03 +09:00]]))
<https://bugzilla.mozilla.org/show_bug.cgi?id=77992>

[32] [CITE@en[1026804 – Make Event.timeStamp return a DOMHighResTimeStamp by default (switch on pref)]]
( ([TIME[2016-06-20 11:33:35 +09:00]]))
<https://bugzilla.mozilla.org/show_bug.cgi?id=1026804>

[33] [CITE@en[receivedTime and upcoming DOM update · Issue #145 · WebAudio/web-midi-api]]
( ([TIME[2016-06-20 11:37:18 +09:00]]))
<https://github.com/WebAudio/web-midi-api/issues/145>

[35] [CITE@en[Issue 574514 - chromium - MSE conformance test failure related to event.timeStamp - Monorail]]
( ([TIME[2016-06-20 11:44:55 +09:00]]))
<https://bugs.chromium.org/p/chromium/issues/detail?id=574514>

[36] [CITE[High Resolution Timestamps for Events | Web Updates - Google Developers]]
( ([TIME[2016-05-19 01:39:56 +09:00]]))
<https://developers.google.com/web/updates/2016/01/high-res-timestamps>

[37] [CITE@en[Timestamp data types and HTMLMediaElement currentTime · Issue #41 · w3c/tvcontrol-api]]
([TIME[2017-03-18 19:00:33 +09:00]])
<https://github.com/w3c/tvcontrol-api/issues/41>

[38] [CITE@en[Use DOMTimeStamp type for date and time values · Issue #5 · w3c/tvcontrol-api]]
([TIME[2017-03-18 19:01:58 +09:00]])
<https://github.com/w3c/tvcontrol-api/issues/5>

[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>

** 改名

[41] [CITE@en[Define the EpochTimeStamp typedef by marcoscaceres · Pull Request #124 · w3c/hr-time · GitHub]], [TIME[2021-10-10T05:12:45.000Z]] <https://github.com/w3c/hr-time/pull/124/files>

[42] [CITE@en[Remove DOMTimeStamp by marcoscaceres · Pull Request #1021 · whatwg/webidl · GitHub]], [TIME[2021-10-10T05:14:39.000Z]] <https://github.com/whatwg/webidl/pull/1021>

[43] [CITE@en[DOMTimeStamp confusion · Issue #2 · whatwg/webidl · GitHub]], [TIME[2021-10-10T05:15:39.000Z]] <https://github.com/whatwg/webidl/issues/2>