From 687af63c29a6b8e09e8f5d4becd035b12d0d0295 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Thu, 19 Dec 2019 22:08:32 +0100 Subject: update timestamp docs --- core/api-common.rst | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'core/api-common.rst') diff --git a/core/api-common.rst b/core/api-common.rst index eb40a629..6199bb63 100644 --- a/core/api-common.rst +++ b/core/api-common.rst @@ -145,22 +145,24 @@ as other binary data in Crockford Base32 encoding. Timestamps ^^^^^^^^^^ -Timestamps are represented in JSON as a string literal ``"\\/Date(x)\\/"``, -where ``x`` is the decimal representation of the number of seconds past the -Unix Epoch (January 1, 1970). The escaped slash (``\\/``) is interpreted in -JSON simply as a normal slash, but distinguishes the timestamp from a normal -string literal. We use the type "date" in the documentation below. -Additionally, the special strings ``"\\/never\\/"`` and ``"\\/forever\\/"`` are -recognized to represent the end of time. +Timestamps are represented by the following structure: .. ts:def:: Timestamp - type Timestamp = string; - + interface Timestamp { + // Milliseconds since epoch, or the special + // value "forever" to represent an event that will + // never happen. + t_ms: number | "never"; + } .. ts:def:: RelativeTime - type RelativeTime = string; + type Duration { + // Duration in milliseconds or "forever" + // to represent an infinite duration. + d_ms: number | "forever"; + } .. _public\ key: -- cgit v1.2.3