22 lines
909 B
Markdown
22 lines
909 B
Markdown
# clocktime
|
|
|
|
clocktime provides a type that holds a calendar-independent time of day value in 24-hour format.
|
|
|
|
clocktime provides basic types that extend Go's built-in time.Time to provide time-of-day and duration support.
|
|
|
|
## `clocktime.ClockTime
|
|
|
|
Holds calendar-independent time-of-day in 24-hour format.
|
|
|
|
- Converts to and from `HH:MM:SS` format (subset of ISO8061)
|
|
- Marshals to `[]byte` containing string `HH:MM:SS` for SQL
|
|
- Marshals to `string` in format `HH:MM:SS` for JSON & gqlgen
|
|
|
|
## `clocktime.Duration`
|
|
|
|
Wraps time.Duration with prioritized ISO8061 support and opinionated marshalling.
|
|
|
|
- Converts to and from ISO8061 format (utilises [sosodev/duration](https://github.com/sosodev/duration))
|
|
- Marshals to `uint64` with nanosecond precision. Largest representatable duration is about 290 years, limited by underlying time.Duration type.
|
|
- Marshals to `string` in ISO8061 format for JSON & gqlgen
|