new LeapSecond
Describes a single leap second, which is constructed from a JulianDate and a numerical offset representing the number of seconds TAI is ahead of the UTC time standard.
Parameters:
| Name | Type | Description |
|---|---|---|
date |
JulianDate | A Julian date representing the time of the leap second. |
offset |
Number | The cumulative number of seconds, that TAI is ahead of UTC at provided date. |
Throws:
-
DeveloperError :
dateis required. -
DeveloperError :
offsetis required.
Example
// Example 1. Construct a LeapSecond using a JulianDate
var date = new Date('January 1, 1990 00:00:00 UTC');
var leapSecond = new LeapSecond(JulianDate.fromDate(date), 25.0);
var offset = leapSecond.offset; // 25.0
//////////////////////////////////////////////////////////////////
// Example 2. Construct a LeapSecond using a date string
var date = 'January 1, 1990 00:00:00 UTC';
var leapSecond = new LeapSecond(date, 25.0);
See:
Source:
Members
-
julianDate :JulianDate
-
The Julian date at which this leap second occurs.
-
offset :Number
-
The cumulative number of seconds between the UTC and TAI time standards at the time of this leap second.
Methods
-
equals
-
Checks whether two leap seconds are equivalent to each other.
Parameters:
Name Type Description otherLeapSecond The leap second to compare against. Returns:
Booleantrueif the leap seconds are equal; otherwise,false.Example
var date = new Date('January 1, 1990 00:00:00 UTC'); var leapSecond1 = new LeapSecond(JulianDate.fromDate(date), 25.0); var leapSecond2 = new LeapSecond(JulianDate.fromDate(date), 25.0); leapSecond1.equals(leapSecond2); // true -
<static> compareLeapSecondDate
-
Given two leap seconds, determines which comes before the other by comparing their respective Julian dates.
Parameters:
Name Type Description leapSecond1LeapSecond The first leap second to be compared. leapSecond2LeapSecond The second leap second to be compared. Returns:
Number A negative value if the first leap second is earlier than the second, a positive value if the first leap second is later than the second, or zero if the two leap seconds are equal (ignoring their offsets).Example
var date = new Date('January 1, 2006 00:00:00 UTC'); var leapSecond1 = new LeapSecond(JulianDate.fromDate(date), 33.0); var leapSecond2 = new LeapSecond(JulianDate.fromDate(date), 34.0); LeapSecond.compareLeapSecondDate(leapSecond1, leapSecond2); // returns 0- JulianDate#lessThan
- JulianDate#isAfter
See:
-
<static> getLeapSeconds
-
Returns a copy of the array of leap seconds used throughout Cesium. By default, this is the official list of leap seconds that was available when Cesium was released.
Returns:
Array A list of LeapSecond objects. -
<static> setLeapSeconds
-
Sets the list of leap seconds used throughout Cesium.
Parameters:
Name Type Description leapSecondsArray An array of LeapSecond objects. Throws:
DeveloperErrpr : leapSeconds is required and must be an array.Example
LeapSecond.setLeapSeconds([ new LeapSecond(new JulianDate(2453736, 43233.0, TimeStandard.TAI), 33), // January 1, 2006 00:00:00 UTC new LeapSecond(new JulianDate(2454832, 43234.0, TimeStandard.TAI), 34), // January 1, 2009 00:00:00 UTC new LeapSecond(new JulianDate(2456109, 43235.0, TimeStandard.TAI), 35) // July 1, 2012 00:00:00 UTC ]);
