Skip to content

Commit 0bd75b3

Browse files
cynthiarhiaro
andauthored
Goodbye DOMTimeStamp, hello DOMHighResTimeStamp (#334)
* Update index.bs * Update index.bs Co-authored-by: Amy Guy <[email protected]> * Update index.bs * Update index.bs Co-authored-by: Amy Guy <[email protected]> Co-authored-by: Amy Guy <[email protected]>
1 parent e2230d0 commit 0bd75b3

File tree

1 file changed

+6
-20
lines changed

1 file changed

+6
-20
lines changed

index.bs

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2106,11 +2106,14 @@ not as an integer value of a smaller time unit like nanoseconds.
21062106

21072107
<h3 id="times-and-dates">Use the appropriate type to represent times and dates</h3>
21082108

2109-
When representing date-times on the platform, use the {{DOMTimeStamp}} type.
2110-
Use {{DOMHighResTimeStamp}} if authors
2111-
must always be able to compare timestamps,
2109+
When representing date-times on the platform, use the {{DOMHighResTimeStamp}} type.
2110+
{{DOMHighResTimeStamp}} allows comparison of timestamps,
21122111
regardless of the user's time settings.
21132112

2113+
{{DOMHighResTimeStamp}} values represent
2114+
a time value in milliseconds.
2115+
See [[!HIGHRES-TIME]] for more details.
2116+
21142117
Don't use the JavaScript {{Date}} class for representing
21152118
specific date-time values.
21162119
{{Date}} objects are mutable (may have their value changed),
@@ -2126,23 +2129,6 @@ and there is no way to make them immutable.
21262129
on the Web IDL Bugzilla
21272130
</div>
21282131

2129-
{{DOMTimeStamp}} values represent
2130-
the number of milliseconds since 1970-01-01T00:00:00Z.
2131-
They are derived from the system's clock,
2132-
which may be changed by the user,
2133-
or automatically for things like time zone updates
2134-
or daylight savings.
2135-
This means that, in practice, a {{DOMTimeStamp}}
2136-
created later in real time
2137-
may have a lower value than a {{DOMTimeStamp}} created earlier.
2138-
Also, if two {{DOMTimeStamp}}s are created within the same millisecond,
2139-
there's no way to know which was created earlier.
2140-
2141-
So, if a date-time is only used to compare timing of events,
2142-
and not to show a formatted date-time value to the user,
2143-
consider using {{DOMHighResTimeStamp}} instead.
2144-
See [[!HIGHRES-TIME]] for more details.
2145-
21462132
<h3 id="error-types">Use Error or DOMException for errors</h3>
21472133

21482134
Represent errors in web APIs as ECMAScript error objects (e.g., {{Error}})

0 commit comments

Comments
 (0)