diff --git a/text/0080-datetime-extension.md b/text/0080-datetime-extension.md index 3127a16f..4dde787c 100644 --- a/text/0080-datetime-extension.md +++ b/text/0080-datetime-extension.md @@ -151,9 +151,9 @@ Values of type `datetime` can also be used with the `-` operator. An invariant for the `-` operator is that when `DT1` is before `DT2` the resulting duration is negative. -`DT1` may be negative (_i.e._ milliseconds _before_ `1970-01-01T00:00:00Z`) requiring that `-` be computed specially: +The internal representation of `DT1` may be negative (_i.e._ representing milliseconds _before_ `1970-01-01T00:00:00Z`) requiring that `-` be computed specially: -``` +```cedar if DT1 < 0 && DT2 >= 0 then result = -(DT1 - DT2) else @@ -173,12 +173,11 @@ Values of type `datetime` can be used with comparison operators: Equality is based on the underlying representation (see below) so, for example, `datetime("2024-08-21T") == datetime("2024-08-21T00:00:00.000Z")` is true. This behavior is consistent with the decimal extension function, where `decimal("1.0") == decimal("1.0000")` is also true. - #### Representation The `datetime` type is internally represented as a `long` and contains a Unix Time in milliseconds. This is the number of non-leap seconds that have passed since `1970-01-01T00:00:00Z` in milliseconds. Unix Time days are always 86,400 seconds and handle leap seconds by absorbing them at the start of the day. Due to using Unix Time, and not providing a "current time" function, Cedar avoids the complexities of leap second handling, pushing them to the system and application. -Negative Unix Time values represent the number of milliseconds before `1970-01-01T00:00:00Z`. +Negative Unix Time values represent the number of milliseconds before `1970-01-01T00:00:00Z`. ### Durations of Time (`duration`)