@@ -2106,11 +2106,14 @@ not as an integer value of a smaller time unit like nanoseconds.
2106
2106
2107
2107
<h3 id="times-and-dates">Use the appropriate type to represent times and dates</h3>
2108
2108
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,
2112
2111
regardless of the user's time settings.
2113
2112
2113
+ {{DOMHighResTimeStamp}} values represent
2114
+ a time value in milliseconds.
2115
+ See [[!HIGHRES-TIME]] for more details.
2116
+
2114
2117
Don't use the JavaScript {{Date}} class for representing
2115
2118
specific date-time values.
2116
2119
{{Date}} objects are mutable (may have their value changed),
@@ -2126,23 +2129,6 @@ and there is no way to make them immutable.
2126
2129
on the Web IDL Bugzilla
2127
2130
</div>
2128
2131
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
-
2146
2132
<h3 id="error-types">Use Error or DOMException for errors</h3>
2147
2133
2148
2134
Represent errors in web APIs as ECMAScript error objects (e.g., {{Error}} )
0 commit comments