Create a new time value. Both parameters must be non-negative integers; an error will be thrown otherwise. The second parameter is optional.
Number of seconds in the interval.
Remaining number of nanoseconds (defaults to zero).
Protected
nanosecondsRemaining number of nanoseconds (defaults to zero).
Protected
secondsNumber of seconds in the interval.
Return true if this time value denotes a time interval of smaller length than the time interval encoded by the time value given as a parameter; return false otherwise.
NOTE: Performing this comparison involves a conversion to a big integer and is therefore relatively costly.
The time value to compare to this one.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt|BigInt for further information.
Return true if this time value denotes a time interval of equal length as the interval encoded by the time value given as a parameter.
The time value to compare to this one.
Return true if this time value is later than the time given as a parameter.
The time value to compare to this one.
Static
foreverStatic
fromStatic
msecStatic
msecsStatic
neverStatic
nsecStatic
nsecsStatic
secStatic
secsStatic
secsStatic
usecStatic
usecsStatic
withGive a value and time unit, return a new time value.
The value is a number
that is required to be
a positive integer. The time unit must be a member of the TimeUnit
enum.
A number (which must be a positive integer) that denotes the length of the specified time interval, expressed as a multiple of the given time unit.
The unit of measurement that applies to the given value.
Static
zero
A time value given in nanosecond precision. To prevent overflow (which would occur for time intervals spanning more than 0.29 years if a single JavaScript number, which has 2^53 bits of precision, were to be used), we use two numbers to store a time value. The first number denotes the number of whole seconds in the interval; the second number denotes the remaining number of nanoseconds in the interval. This class serves as a base class for
UnitBasedTimeValue
, which provides the convenience of defining time values as a single number accompanied by a unit.See