Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Somewhat simplify the description of Period. #25

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 21 additions & 13 deletions draft-ietf-cbor-time-tag.md
Original file line number Diff line number Diff line change
Expand Up @@ -703,30 +703,38 @@ durations here.
Period Format {#period}
=============

A period is a specific interval of time, specified as either two times
giving the start and the end of that interval, or as one of these two
plus a duration.
A period is a specific interval of time, specified as either two
extended times giving the start and the end of that interval, or as
one of these two plus a duration.

They are given as an array of unwrapped time and duration elements,
tagged with Tag 1003:
This is represented as an array of unwrapped time and duration elements,
tagged with Tag 1003, one of:

* a start and end time, in which case the
tag content is an array of two unwrapped extended time elements;

* a start time with duration or an end time with duration.
The tag content is an array of 3 elements: the first two as
above but either the start or end time MUST be set to null; the
third one then is an unwrapped duration.

A simple CDDL definition that does not capture all the constraints is:

~~~ cddl
Period = #6.1003([
simple-Period = #6.1003([
start: ~Etime / null
end: ~Etime / null
? duration: ~Duration / null
? duration: ~Duration
])
~~~

If the third array element is not given, the duration element is null.
Exactly two out of the three elements must be non-null, this can be
somewhat verbosely expressed in CDDL as:
Exactly two out of the three elements must be present and non-null;
this can be somewhat more verbosely expressed in CDDL as:

~~~ cddl
clumsy-Period = #6.1003([
Period = #6.1003([
(start: ~Etime,
((end: ~Etime,
? duration: null) //
((end: ~Etime) //
(end: null,
duration: ~Duration))) //
(start: null,
Expand Down
Loading