io7m-com / cedarbridge

Cedarbridge message protocol specification language
https://www.io7m.com/software/cedarbridge
ISC License
0 stars 0 forks source link

Add standard time and duration types #34

Closed io7m closed 1 year ago

io7m commented 1 year ago

The standard Duration type can be represented as:

[record Duration
  [field seconds cb:Unsigned64]
  [field nanos   cb:Unsigned32]
]

The nanos field is actually defined as never exceeding 999999999.

io7m commented 1 year ago

The standard OffsetDateTime can be represented as:

[record OffsetDateTime
  [field local LocalDateTime]
  [field zone  ZoneOffset]
]

Where:

[record LocalDate
  [field year  cb:Unsigned32]
  [field month cb:Unsigned16]
  [field day   cb:Unsigned16]
]

[record LocalTime
  [field hour   cb:Unsigned8]
  [field minute cb:Unsigned8]
  [field second cb:Unsigned8]
  [field nanos  cb:Unsigned32]
]

[record LocalDateTime
  [field date LocalDate]
  [field time LocalTime]
]

[record ZoneOffset
  [field seconds cb:Unsigned32]
]
io7m commented 1 year ago

Given the number of types involved, this should probably be introduced into a new package.