aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-util
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2023-05-26 11:12:44 +0200
committerFlorian Dold <florian@dold.me>2023-05-26 11:12:44 +0200
commit6e13fce8a9c0037ce5fb8a9c2a9e5028e1ef1f5d (patch)
tree80d6f083f741c867007ccbcc123b4f5644a947ca /packages/taler-util
parent735336d751ceee390f225d567e8e7604f44d7c31 (diff)
taler-util: compile-time flavor for timestamp types
Diffstat (limited to 'packages/taler-util')
-rw-r--r--packages/taler-util/src/time.ts25
1 files changed, 25 insertions, 0 deletions
diff --git a/packages/taler-util/src/time.ts b/packages/taler-util/src/time.ts
index 8b4f4cac3..6ada13e25 100644
--- a/packages/taler-util/src/time.ts
+++ b/packages/taler-util/src/time.ts
@@ -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 {