-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
33 lines (28 loc) · 806 Bytes
/
index.ts
File metadata and controls
33 lines (28 loc) · 806 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { NTPClient } from './client.js';
import { NTPParser } from './parser.js';
export { NTPClient, NTPParser };
export type { NTPClientConfig, NTPQueryResult } from './client.js';
export type {
RawNTPTimestamp,
ParsedNTPTimestamp,
NTPPacketHeader,
NTPTimestamps,
ParsedNTPPacket,
} from './parser.js';
// Default export with convenience functions
export default {
async getTime(host = 'time.hixbe.com'): Promise<Date> {
const client = new NTPClient({ host });
return client.getTime();
},
async getOffset(host = 'time.hixbe.com'): Promise<number> {
const client = new NTPClient({ host });
return client.getOffset();
},
async query(host = 'time.hixbe.com') {
const client = new NTPClient({ host });
return client.query();
},
NTPClient,
NTPParser,
};