Storing Timestamps and Durations

A timestamp identifies an observation time under a declared convention. A duration measures the difference or a length of time.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Read one source record
  2. Test behavior across zones
  3. Distinguish a time point from elapsed time
  4. Test date and offset transitions

Read one source record

Writing an elapsed duration of 1500 with unit milliseconds does not date the event. A wall-clock stamp needs a calendar convention and time zone or offset. Values and units guide separate field names and conversions.

Test behavior across zones

Store a known instant and display it in two zones. Local date or clock time may change while the stored instant remains the same. Date conditions show why local policy belongs at a deliberate interpretation stage.[1]

Distinguish a time point from elapsed time

A log printed at 11:58 and again at 12:03 appears five minutes apart on one stable local clock. A timestamp with explicit offset or UTC identifies an instant across machines. To measure a duration reliably within one process, use a clock designed for elapsed intervals. See sequences of events.

Event instant: 2026-06-02T10:58:00Z
Later instant: 2026-06-02T11:03:00Z
Difference in this example: 300 s
Same wall times with different UTC offsets can refer to different instants

Test date and offset transitions

A local timestamp without an offset can be ambiguous during a clock change. Storing an elapsed duration alongside an event instant can make analysis more direct. Declare precision and the time basis before combining measurements.

References

  1. IETF, RFC 3629: UTF-8, a Transformation Format of ISO 10646 ↩