ntpclient 1.15.0 → 1.15.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
+ import { program as commander } from 'commander';
2
3
  import fs from 'node:fs/promises';
3
4
  import path from 'node:path';
4
- import { program as commander } from 'commander';
5
5
  import { NTPClient } from './index.js';
6
6
  const __dirname = import.meta.dirname;
7
7
  const packageJsonPath = path.join(__dirname, '../package.json');
package/dist/index.js CHANGED
@@ -31,6 +31,7 @@ export class NTPClient {
31
31
  }
32
32
  return new Promise((resolve, reject) => {
33
33
  const client = dgram.createSocket('udp4');
34
+ // eslint-disable-next-line no-magic-numbers
34
35
  const ntpData = Buffer.alloc(48);
35
36
  // RFC 2030 -> LI = 0 (no warning, 2 bits), VN = 3 (IPv4 only, 3 bits), Mode = 3 (Client Mode, 3 bits) -> 1 byte
36
37
  // -> rtol(LI, 6) ^ rotl(VN, 3) ^ rotl(Mode, 0)
@@ -75,13 +76,18 @@ export class NTPClient {
75
76
  let intpart = 0;
76
77
  let fractpart = 0;
77
78
  // Get the seconds part
79
+ // eslint-disable-next-line no-magic-numbers
78
80
  for (let index = 0; index <= 3; index++) {
81
+ // eslint-disable-next-line no-magic-numbers
79
82
  intpart = 256 * intpart + msg[offsetTransmitTime + index];
80
83
  }
81
84
  // Get the seconds fraction
85
+ // eslint-disable-next-line no-magic-numbers
82
86
  for (let index = 4; index <= 7; index++) {
87
+ // eslint-disable-next-line no-magic-numbers
83
88
  fractpart = 256 * fractpart + msg[offsetTransmitTime + index];
84
89
  }
90
+ // eslint-disable-next-line no-magic-numbers
85
91
  const milliseconds = intpart * 1000 + (fractpart * 1000) / 4294967296;
86
92
  // **UTC** time
87
93
  const date = new Date('Jan 01 1900 GMT');
package/package.json CHANGED
@@ -2,14 +2,14 @@
2
2
  "author": "Florian Imdahl <git@ffflorian.de>",
3
3
  "bin": "dist/cli.js",
4
4
  "dependencies": {
5
- "commander": "14.0.2"
5
+ "commander": "14.0.3"
6
6
  },
7
7
  "description": "A TypeScript implementation of the NTP Client Protocol",
8
8
  "devDependencies": {
9
9
  "rimraf": "6.1.2",
10
10
  "tsx": "4.21.0",
11
11
  "typescript": "5.9.3",
12
- "vitest": "4.0.16"
12
+ "vitest": "4.0.18"
13
13
  },
14
14
  "engines": {
15
15
  "node": ">= 21"
@@ -31,6 +31,6 @@
31
31
  "test": "vitest run"
32
32
  },
33
33
  "type": "module",
34
- "version": "1.15.0",
35
- "gitHead": "b968c846095113cbe57fbdd34e4593a4dea8a1c9"
34
+ "version": "1.15.2",
35
+ "gitHead": "59997e7c64b551213644945256b13ff3ba1ccfcd"
36
36
  }