time_point
Stable type · Other
Tier: stable · Kind: type · Topic: Other
| Julia | TypeScript | Python | Rust | Go |
|---|---|---|---|---|
| not exported | not exported | not exported | TimePoint | TimePoint |
Julia
Julia does not export this type.
TypeScript
TypeScript does not export this type.
Python
Python does not export this type.
Rust
pub enum TimePoint {
Seconds(Number),
Timestamp(String),
}
One bound of a SolverTimeSpan
, kept in its authored form.
Go
type TimePoint struct {
Number *float64
Timestamp *string
// contains filtered or unexported fields
}
func (p TimePoint) MarshalJSON() ([]byte, error)
func (p *TimePoint) UnmarshalJSON(data []byte) error
TimePoint is one bound of a SolverTimeSpan: either a number in the document’s time units (seconds of the independent variable) or an RFC 3339 UTC timestamp (YYYY-MM-DDThh:mm:ss(.f+)?Z), which means the seconds from the document’s time origin to that instant (esm-spec §2.2.7). Exactly one of Number and Timestamp is set. It round-trips verbatim: a timestamp stays the string, a number stays the number written (1.0 emits as 1.0, 0 as 0).
Methods
func (p TimePoint) MarshalJSON() ([]byte, error)
MarshalJSON writes the bound back as authored: the timestamp string, or the number.
func (p *TimePoint) UnmarshalJSON(data []byte) error
UnmarshalJSON reads a bound that is a JSON number or a JSON string. The string’s form is the schema’s to judge; it is held as written.