mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
Merge pull request #33603 from adamzerella/types/sntp
[sntp] Add typing for sntp
This commit is contained in:
41
types/sntp/index.d.ts
vendored
Normal file
41
types/sntp/index.d.ts
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
// Type definitions for sntp 3.0
|
||||
// Project: https://github.com/hueniverse/sntp
|
||||
// Definitions by: Adam Zerella <https://github.com/adamzerella>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export interface Options {
|
||||
host?: string;
|
||||
port?: number;
|
||||
resolveReference?: boolean;
|
||||
timeout?: number;
|
||||
}
|
||||
|
||||
export interface TimeOptions {
|
||||
isValid: boolean;
|
||||
leapIndicator: string;
|
||||
version: number;
|
||||
mode: string;
|
||||
stratum: string;
|
||||
pollInterval: number;
|
||||
precision: number;
|
||||
rootDelay: number;
|
||||
rootDispersion: number;
|
||||
referenceId: string;
|
||||
referenceTimestamp: number;
|
||||
originateTimestamp: number;
|
||||
receiveTimestamp: number;
|
||||
transmitTimestamp: number;
|
||||
d: number;
|
||||
t: number;
|
||||
receivedLocally: number;
|
||||
}
|
||||
|
||||
export function start(options?: Options): Promise<void>;
|
||||
|
||||
export function stop(): void;
|
||||
|
||||
export function offset(): Promise<number>;
|
||||
|
||||
export function time(options?: Options): Promise<TimeOptions>;
|
||||
|
||||
export function now(): number;
|
||||
18
types/sntp/sntp-tests.ts
Normal file
18
types/sntp/sntp-tests.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import Sntp = require('sntp');
|
||||
|
||||
const options = {
|
||||
host: 'abc',
|
||||
port: 123,
|
||||
};
|
||||
|
||||
Sntp.now();
|
||||
|
||||
Sntp.start(options);
|
||||
Sntp.start();
|
||||
|
||||
Sntp.stop();
|
||||
|
||||
Sntp.time(options);
|
||||
Sntp.time();
|
||||
|
||||
Sntp.offset();
|
||||
25
types/sntp/tsconfig.json
Normal file
25
types/sntp/tsconfig.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [
|
||||
|
||||
],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"sntp-tests.ts"
|
||||
]
|
||||
}
|
||||
3
types/sntp/tslint.json
Normal file
3
types/sntp/tslint.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Reference in New Issue
Block a user