Skip to content

Commit 58e8a93

Browse files
committed
Add support for displaying ΔUT1 and ΔTAI. Improve efficacy of AWC_DEBUG_TIME.
1 parent ee5248f commit 58e8a93

16 files changed

Lines changed: 253 additions & 63 deletions

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ dist
22
e2e
33
node_modules
44
raspberry_pi_setup
5+
tsc-out

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ To test and build the web client project, you can use the following commands:
1111
> Note: As of the time of this writing, the build will not work with Node 11 or later on Linux (including Raspbian)
1212
because of a dependency on `node-sass`. Even when using Node 10.x or earlier you might get some errors with `npm install`
1313
due to `node-sass`. I found that using `LIBSASS_EXT="no" npm install` helped. If you have a problem, and this doesn't
14-
fix it, search for solutions based on `node-sass` and any specific error messages you recieve.
14+
fix it, search for solutions based on `node-sass` and any specific error messages you receive.
1515

1616

1717
To run the weather server, use "`npm start`" from within the server directory.

package-lock.json

Lines changed: 30 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "aw-clock",
3-
"version": "1.2.6",
3+
"version": "1.2.7",
44
"license": "MIT",
55
"author": "Kerry Shetline <kerry@shetline.com>",
66
"scripts": {
@@ -9,8 +9,7 @@
99
"build-for-dht": "webpack && cd server && npm run build-for-dht && cd .. && cp -Rp dist/ server/dist/public/",
1010
"test": "karma start ./karma.conf.js",
1111
"lint": "eslint \"**/*.ts\" \"**/*.js\"",
12-
"e2e": "protractor ./protractor.conf.js",
13-
"pree2e": "webdriver-manager update --standalone false --gecko false --quiet"
12+
"e2e": "protractor ./protractor.conf.js"
1413
},
1514
"private": true,
1615
"dependencies": {
@@ -26,13 +25,13 @@
2625
},
2726
"devDependencies": {
2827
"@types/follow-redirects": "^1.8.0",
29-
"@types/jasmine": "^3.5.0",
28+
"@types/jasmine": "^3.5.1",
3029
"@types/jasminewd2": "^2.0.8",
3130
"@types/jquery": "^3.3.31",
3231
"@types/js-cookie": "^2.2.4",
33-
"@types/node": "^13.1.7",
34-
"@typescript-eslint/eslint-plugin": "^2.16.0",
35-
"@typescript-eslint/parser": "^2.16.0",
32+
"@types/node": "^13.1.8",
33+
"@typescript-eslint/eslint-plugin": "^2.17.0",
34+
"@typescript-eslint/parser": "^2.17.0",
3635
"autoprefixer": "^9.7.4",
3736
"circular-dependency-plugin": "^5.2.0",
3837
"copy-webpack-plugin": "~5.1.1",
@@ -65,7 +64,7 @@
6564
"raw-loader": "^4.0.0",
6665
"sass-loader": "^8.0.2",
6766
"source-map-loader": "^0.2.4",
68-
"style-loader": "^1.1.2",
67+
"style-loader": "^1.1.3",
6968
"stylus-loader": "^3.0.2",
7069
"terser-webpack-plugin": "^2.3.2",
7170
"ts-loader": "^6.2.1",

protractor.conf.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ function flushStderr() {
2626
}
2727
}
2828

29+
// noinspection JSUnusedGlobalSymbols
2930
exports.config = {
3031
allScriptsTimeout: 11000,
3132
specs: [

server/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "aw-clock-server",
3-
"version": "1.2.6",
3+
"version": "1.2.7",
44
"license": "MIT",
55
"author": "Kerry Shetline <kerry@shetline.com>",
66
"private": true,
@@ -33,7 +33,7 @@
3333
"@types/mocha": "^5.2.7",
3434
"@types/morgan": "^1.7.37",
3535
"@types/nock": "^11.1.0",
36-
"@types/node": "^13.1.7",
36+
"@types/node": "^13.1.8",
3737
"@types/promise-ftp": "^1.3.4",
3838
"@types/request": "^2.48.4",
3939
"chai": "^4.2.0",

server/src/app.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,13 @@ const ntpPoller = new NtpPoller(ntpServer);
6666
const daytimeServer = process.env.AWC_DAYTIME_SERVER || DEFAULT_DAYTIME_SERVER;
6767
const daytime = new Daytime(daytimeServer);
6868
const leapSecondsUrl = process.env.AWC_LEAP_SECONDS_URL || DEFAULT_LEAP_SECOND_URLS;
69-
const taiUtc = new TaiUtc(leapSecondsUrl);
69+
let taiUtc = new TaiUtc(leapSecondsUrl);
7070

7171
if (process.env.AWC_DEBUG_TIME) {
7272
const parts = process.env.AWC_DEBUG_TIME.split(';'); // UTC-time [;optional-leap-second]
7373
ntpPoller.setDebugTime(new Date(parts[0]), Number(parts[1] || 0));
74+
const debugDelta = Date.now() - new Date(parts[0]).getTime();
75+
taiUtc = new TaiUtc(leapSecondsUrl, () => Date.now() - debugDelta);
7476
}
7577

7678
function readSensor() {

server/src/tai-utc.spec.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,34 @@ describe('tai-utc', () => {
1717
});
1818

1919
it('should get TAI-UTC and pending leap second', async function () {
20+
this.slow(5000);
21+
this.timeout(20000);
2022
let data: any;
2123

2224
data = await (new TaiUtc('http://example.com/1', () => new Date(2016, 6, 1).getTime()).getCurrentDelta());
25+
delete data.dut1;
2326
expect(data).to.eql({ delta: 36, pendingLeap: 1, pendingLeapDate: '2016-12-31' });
2427

2528
data = await (new TaiUtc('http://example.com/2', () => new Date(2020, 0, 1).getTime()).getCurrentDelta());
29+
delete data.dut1;
2630
expect(data).to.eql({ delta: 37, pendingLeap: 1, pendingLeapDate: '2021-12-31' });
2731

2832
data = await (new TaiUtc('http://example.com/2', () => new Date(2022, 0, 1).getTime()).getCurrentDelta());
33+
delete data.dut1;
2934
expect(data).to.eql({ delta: 38, pendingLeap: 0, pendingLeapDate: null });
3035

3136
data = await (new TaiUtc('http://example.com/3', () => new Date(2020, 0, 1).getTime()).getCurrentDelta());
37+
delete data.dut1;
3238
expect(data).to.eql({ delta: 37, pendingLeap: -1, pendingLeapDate: '2021-12-31' });
3339

3440
data = await (new TaiUtc('http://example.com/3', () => new Date(2022, 0, 1).getTime()).getCurrentDelta());
41+
delete data.dut1;
3542
expect(data).to.eql({ delta: 36, pendingLeap: 0, pendingLeapDate: null });
3643
});
3744

3845
it('should get leap second history', async function () {
46+
this.slow(5000);
47+
this.timeout(20000);
3948
let data: any;
4049

4150
data = await (new TaiUtc('http://example.com/1', () => new Date(2016, 6, 1).getTime()).getLeapSecondHistory());

0 commit comments

Comments
 (0)