Skip to content

Commit

Permalink
Updated historic delta-T values from http://astro.ukho.gov.uk/nao/lvm/ (
Browse files Browse the repository at this point in the history
#11)

* Updated historic delta-T values from http://astro.ukho.gov.uk/nao/lvm/ (replacing data from maia.usno.navy.mil and https://stjarnhimlen.se/comp/time.html).
* Added predicted delta-T for start of 2022.
* Updated rough predictive future delta-T calculations.
  • Loading branch information
kshetline committed Apr 28, 2021
1 parent 1de0107 commit f24f7ec
Show file tree
Hide file tree
Showing 9 changed files with 107 additions and 105 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@ Note that this only works for defined leap seconds. `new DateTime('2021-04-15 23
* From TAI, Julian date, or modified Julian date values. For example:<br>
`new DateTime('1972-07-01T00:00:10 TAI', 'UTC').toString()`
`"DateTime<1972-06-30T23:59:60.000 +00:00>"`<br>
`new DateTime({ jde: 2450630.500724913 }, 'UTC').toIsoString(19)`
`new DateTime({ jde: 2450630.5007242477 }, 'UTC').toIsoString(19)`
`"1997-06-30T23:59:60"`<br><br>
* By add/subtract operations using TAI quantities:
`new DateTime('2016-12-31 18:59:59 EST').add('seconds_tai', 1).toString()`
Expand Down Expand Up @@ -1286,6 +1286,7 @@ addDaysToDate(deltaDays: number, yearOrDate: YearOrDate, month?: number, day?: n
```typescript
static OS_ZONE: Timezone; // Local timezone as derived from analyzing values returned by JavaScript `Date`.
static TAI_ZONE: Timezone; // International Atomic Time (TAI).
static UT_ZONE: Timezone; // Universal Coordinated Time (AKA UTC, UCT, GMT, Zulu Time, etc.)
static ZONELESS: Timezone; // A pseudo timezone for abstract date/time instances.
static DATELESS: Timezone; // A pseudo timezone for abstract dateless, time-only `DateTime` instances.
Expand Down
22 changes: 11 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@tubular/time",
"version": "2.6.2",
"description": "Date/time, IANA timezones, calendar with settable Julian/Gregorian switchover",
"version": "2.6.4",
"description": "Date/time, IANA timezones, leap seconds, TAI/UTC conversions, calendar with settable Julian/Gregorian switchover",
"browser": "dist/web/index.js",
"browser-es5": "dist/web5/index.js",
"main": "dist/es6/index.js",
Expand All @@ -19,6 +19,7 @@
"document": "typedoc --name \"ks-date-time-zone\" --module commonjs --exclude \"**/*+(e2e|spec|index).ts\" --excludePrivate --excludeProtected --readme README.md --target ES5 --out docs src"
},
"keywords": [
"astronomy",
"calendar",
"date",
"gregorian",
Expand All @@ -27,6 +28,7 @@
"leap second",
"moment",
"olson",
"tdt",
"tai",
"time",
"time zone",
Expand All @@ -44,9 +46,9 @@
"@babel/core": "^7.13.16",
"@babel/preset-env": "^7.13.15",
"@babel/register": "^7.13.16",
"@types/chai": "^4.2.16",
"@types/chai": "^4.2.17",
"@types/mocha": "^8.2.2",
"@types/node": "^14.14.41",
"@types/node": "^14.14.43",
"@typescript-eslint/eslint-plugin": "^4.22.0",
"@typescript-eslint/parser": "^4.22.0",
"babel-loader": "^8.2.2",
Expand All @@ -65,7 +67,7 @@
"terser-webpack-plugin": "^4.2.3",
"ts-node": "^9.1.1",
"typescript": "^4.2.4",
"webpack": "^5.35.1",
"webpack": "^5.36.0",
"webpack-cli": "^4.6.0",
"webpack-node-externals": "^2.5.2"
},
Expand Down
6 changes: 3 additions & 3 deletions src/date-time.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -542,8 +542,8 @@ describe('DateTime', () => {
expect(new DateTime('1995-12-31 23:59:60Z').compare(new DateTime('1995-12-31 23:59:59Z'))).to.be.greaterThan(0);
expect(new DateTime('1996-12-31 23:59:60Z').toString()).to.equal('DateTime<1997-01-01T00:00:00.000 +00:00>');
expect(new DateTime('1972-06-30 23:59:60Z', 'TAI').toString()).to.equal('DateTime<1972-07-01T00:00:10.000 TAI>');
expect(new DateTime('1997-06-30 23:59:60Z').wallTime.jde).to.be.closeTo(2450630.500724913, 1E-9);
expect(new DateTime({ jde: 2450630.500724913 }, 'utc').toIsoString(19)).to.equal('1997-06-30T23:59:60');
expect(new DateTime('1997-06-30 23:59:60Z').wallTime.jde).to.be.closeTo(2450630.5007242477, 1E-9);
expect(new DateTime({ jde: 2450630.5007242477 }, 'utc').toIsoString(19)).to.equal('1997-06-30T23:59:60');

expect(ttime.sort([new DateTime('1995-12-31 23:59:60Z'), new DateTime('1995-12-31 23:59:59Z')])
.map(dt => dt.format(ttime.DATETIME_LOCAL_SECONDS)).join()).to.equal('1995-12-31T23:59:59,1995-12-31T23:59:60');
Expand Down Expand Up @@ -581,7 +581,7 @@ describe('DateTime', () => {
});

it('should correctly handle TDT/UT/TAI conversions', () => {
expect(new DateTime('1945-05-08Z').deltaTaiMillis).to.be.closeTo(-5249, 2);
expect(new DateTime('1945-05-08Z').deltaTaiMillis).to.be.closeTo(-4965, 2);

expect(new DateTime('1995-12-31 23:59:59Z').add('second_tai', 1).toString()).to.equal('DateTime<1995-12-31T23:59:60.000 +00:00>');
expect(new DateTime('1995-12-31 23:59:00Z').add(DateTimeField.MINUTE_TAI, 1).toString()).to.equal('DateTime<1995-12-31T23:59:60.000 +00:00>');
Expand Down
2 changes: 1 addition & 1 deletion src/timezone-large-alt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const timezoneLargeAlt = /* trim-file-start */{ // tz database version: 2021a, years 1800-2088, rounded to nearest minute, filtered, calendar rollbacks eliminated
version: '2021a',
years: '1800-2088',
deltaTs: '69.36 69.36',
deltaTs: '69.36 69.36 69.45',
leapSeconds: '912 1096 1461 1826 2191 2557 2922 3287 3652 4199 4564 4929 5660 6574 7305 7670 8217 8582 8947 9496 10043 10592 13149 14245 15522 16617 17167',
'Africa/Abidjan': '-0016 +0000 0;-g/0/LMT 0/0/GMT;1;-2ldXI;;48e5;BFCIGMGNMLMRSHSLSNTG',
'Africa/Accra': '-0001 +0000 0;-1/0/LMT 0/0/GMT k/k u/0 u/u;1212121212121212121212121212121212121212121212131414141414141;-2bRzX 9RbX fdE 1BAk MLE 1Bck MLE 1Bck MLE 1Bck MLE 1BAk MLE 1Bck MLE 1Bck MLE 1Bck MLE 1BAk MLE 1Bck MLE 1Bck MLE 1Bck MLE 1BAk MLE 1Bck MLE 1Bck MLE 1Bck MLE 1BAk MLE 1Bck MLE 1Bck MLE 1Bck MLE Mok 1BXE M0k 1BXE fak 9vbu bjCu MLu 1Bcu MLu 1BAu MLu 1Bcu MLu 1Bcu MLu 1Bcu MLu;;41e5;GH',
Expand Down
2 changes: 1 addition & 1 deletion src/timezone-large.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const timezoneLarge = /* trim-file-start */{ // tz database version: 2021a, years 1800-2088
version: '2021a',
years: '1800-2088',
deltaTs: '69.36 69.36',
deltaTs: '69.36 69.36 69.45',
leapSeconds: '912 1096 1461 1826 2191 2557 2922 3287 3652 4199 4564 4929 5660 6574 7305 7670 8217 8582 8947 9496 10043 10592 13149 14245 15522 16617 17167',
'Africa/Abidjan': '-001608 +0000 0;-g.8/0/LMT 0/0/GMT;1;-2ldXH.Q;;48e5;BFCIGMGNMLMRSHSLSNTG',
'Africa/Accra': '-000052 +0000 0;-0.Q/0/LMT 0/0/GMT k/k u/0 u/u;1212121212121212121212121212121212121212121212131414141414141;-2bRzX.8 9RbX.8 fdE 1BAk MLE 1Bck MLE 1Bck MLE 1Bck MLE 1BAk MLE 1Bck MLE 1Bck MLE 1Bck MLE 1BAk MLE 1Bck MLE 1Bck MLE 1Bck MLE 1BAk MLE 1Bck MLE 1Bck MLE 1Bck MLE 1BAk MLE 1Bck MLE 1Bck MLE 1Bck MLE Mok 1BXE M0k 1BXE fak 9vbu bjCu MLu 1Bcu MLu 1BAu MLu 1Bcu MLu 1Bcu MLu 1Bcu MLu;;41e5;GH',
Expand Down
2 changes: 1 addition & 1 deletion src/timezone-small.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const timezoneSmall = /* trim-file-start */{ // tz database version: 2021a, years 2016-2026
version: '2021a',
years: '2016-2026',
deltaTs: '69.36 69.36',
deltaTs: '69.36 69.36 69.45',
leapSeconds: '912 1096 1461 1826 2191 2557 2922 3287 3652 4199 4564 4929 5660 6574 7305 7670 8217 8582 8947 9496 10043 10592 13149 14245 15522 16617 17167',
'Africa/Abidjan': '+0000 +0000 0;0/0/GMT;;;;48e5;BFCIGMGNMLMRSHSLSNTG',
'Africa/Algiers': '+0100 +0100 0;10/0/CET;;;;26e5;DZ',
Expand Down
23 changes: 12 additions & 11 deletions src/ut-converter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@ import { round } from '@tubular/math';

const SIX_MONTHS_DAYS = 180;
const TEST_DTS = [
22.51, 23.01, 23.46, 23.63, 23.95, 24.39, 24.34, 24.1, 24.02, 23.98,
23.89, 23.93, 23.88, 23.91, 23.76, 23.91, 23.96, 24.04, 24.35, 24.82,
25.3, 25.77, 26.27, 26.76, 27.27, 27.77, 28.25, 28.7, 29.15, 29.57,
29.97, 30.36, 30.72, 31.07, 31.35, 31.68, 32.17, 32.67, 33.15, 33.58,
33.99, 34.47, 35.03, 35.74, 36.55, 37.43, 38.29, 39.2, 40.18, 41.17,
42.23, 43.37, 44.48, 45.48, 46.46, 47.52, 48.53, 49.59, 50.54, 51.38,
52.17, 52.96, 53.79, 54.34, 54.87, 55.32, 55.82, 56.3, 56.86, 57.57,
58.31, 59.12, 59.98, 60.79, 61.63, 62.3, 62.97, 63.47, 63.83, 64.09,
64.3, 64.47, 64.57, 64.69, 64.85, 65.15, 65.46, 65.78, 66.07, 66.32,
66.6, 66.91, 67.28, 67.64, 68.1, 68.59, 68.97, 69.22, 69.36, 69.36
22.69, 23.12, 23.49, 23.79, 24.02, 24.20, 24.32, 24.39, 24.42, 24.41,
24.38, 24.32, 24.25, 24.16, 24.08, 24.04, 24.06, 24.17, 24.43, 24.83,
25.35, 25.92, 26.51, 27.05, 27.51, 27.89, 28.24, 28.58, 28.93, 29.32,
29.70, 30.00, 30.20, 30.41, 30.76, 31.34, 32.03, 32.65, 33.07, 33.36,
33.62, 33.96, 34.44, 35.09, 35.95, 36.93, 37.96, 38.95, 39.93, 40.95,
42.04, 43.15, 44.24, 45.28, 46.28, 47.29, 48.33, 49.37, 50.36, 51.28,
52.13, 52.94, 53.70, 54.39, 54.98, 55.46, 55.89, 56.37, 56.99, 57.70,
58.45, 59.19, 59.92, 60.68, 61.46, 62.23, 62.90, 63.42, 63.81, 64.08,
64.27, 64.41, 64.55, 64.73, 64.95, 65.20, 65.48, 65.77, 66.06, 66.33,
66.61, 66.92, 67.28, 67.69, 68.11, 68.53, 68.92, 69.24, 69.36, 69.36,
69.45
];

describe('UT/TDT Converter', () => {
Expand All @@ -32,7 +33,7 @@ describe('UT/TDT Converter', () => {
expect(taiToUtMillis(utToTaiMillis(millis, true), true)).to.equal(millis);
}

for (let y = 1922; y <= 2021; ++y) {
for (let y = 1922; y <= 2022; ++y) {
const now = new DateTime([y], 'UTC');
const epochMillis = now.epochMillis;
const deltaTai = round(now.wallTime.deltaTai * 1000);
Expand Down
Loading

0 comments on commit f24f7ec

Please sign in to comment.