taler-util: compile-time flavor for timestamp types
This commit is contained in:
parent
735336d751
commit
6e13fce8a9
@ -23,15 +23,40 @@
|
||||
*/
|
||||
import { Codec, renderContext, Context } from "./codec.js";
|
||||
|
||||
declare const flavor_AbsoluteTime: unique symbol;
|
||||
declare const flavor_TalerProtocolTimestamp: unique symbol;
|
||||
declare const flavor_TalerWalletDbTimestamp: unique symbol;
|
||||
|
||||
export interface AbsoluteTime {
|
||||
/**
|
||||
* Timestamp in milliseconds.
|
||||
*/
|
||||
readonly t_ms: number | "never";
|
||||
|
||||
readonly _flavor?: typeof flavor_AbsoluteTime;
|
||||
}
|
||||
|
||||
export interface TalerProtocolTimestamp {
|
||||
/**
|
||||
* Seconds (as integer) since epoch.
|
||||
*/
|
||||
readonly t_s: number | "never";
|
||||
|
||||
readonly _flavor?: typeof flavor_TalerProtocolTimestamp;
|
||||
}
|
||||
|
||||
export interface TalerWalletDbTimestamp {
|
||||
/**
|
||||
* Seconds (as integer) since epoch.
|
||||
*/
|
||||
readonly t_s: number | "never";
|
||||
|
||||
/**
|
||||
* Optional microsecond offset (non-negative integer).
|
||||
*/
|
||||
readonly off_us?: number;
|
||||
|
||||
readonly _flavor?: typeof flavor_TalerWalletDbTimestamp;
|
||||
}
|
||||
|
||||
export namespace TalerProtocolTimestamp {
|
||||
|
Loading…
Reference in New Issue
Block a user