UNPKG

@hastearcade/snowglobe

Version:

A TypeScript port of CrystalOrb, a high-level Rust game networking library

29 lines 1.85 kB
import { type Opaque } from './types'; export type Timestamp = Opaque<number, 'Timestamp'>; export type FloatTimestamp = Opaque<number, 'FloatTimestamp'>; export type Timestamped<$Type = unknown> = $Type & { timestamp: Timestamp; }; export declare const MIN = -32768; export declare const MAX = 32767; export declare function make(value?: number): Timestamp; export declare function fromSeconds(seconds: number, timestampSeconds: number): Timestamp; export declare function comparableRangeWithMidpoint(timestamp: Timestamp): { min: Timestamp; max: Timestamp; }; export declare function acceptableTimestampRange(baseline: Timestamp, timestamp: Timestamp): boolean; export declare function increment(timestamp: Timestamp): Timestamp; export declare function asSeconds(timestamp: Timestamp | FloatTimestamp, timestampSeconds: number): number; export declare function add(timestamp: Timestamp, rhs: Timestamp | number): Timestamp; export declare function sub(timestamp: Timestamp, rhs: Timestamp | number): Timestamp; export declare function cmp(timestamp1: Timestamp, timestamp2: Timestamp): number; export declare function toFloat(timestamp: Timestamp): FloatTimestamp; export declare function makeFromUnwrappedFloat(frames: number): FloatTimestamp; export declare function makeFromSecondsFloat(seconds: number, timestampSeconds: number): FloatTimestamp; export declare function ceil(timestamp: FloatTimestamp): Timestamp; export declare function floor(timestamp: FloatTimestamp): Timestamp; export declare function subFloat(timestamp: Timestamp | FloatTimestamp, rhs: Timestamp | FloatTimestamp): FloatTimestamp; export declare function set<$Type>(timestamped: $Type | Timestamped<$Type>, timestamp: Timestamp): Timestamped<$Type>; export declare function get(timestamped: Timestamped): Timestamp; //# sourceMappingURL=timestamp.d.ts.map