Documentation
¶
Overview ¶
Package timeutil converts human-friendly time expressions into the microsecond Unix timestamps OpenObserve's search API expects.
This is deliberately the CLI's job, not the agent's: hand-computing microsecond epochs is the single most error-prone part of calling the search API, so the CLI owns it and accepts forgiving inputs (--since 1h, RFC3339, bare dates, epoch seconds/millis/micros, and now±duration expressions).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromMicros ¶
FromMicros converts Unix microseconds back to a UTC time.Time.
func ParseFlexDuration ¶
ParseFlexDuration parses a duration string. In addition to Go's native units (s, m, h) it understands d (days) and w (weeks), e.g. "15m", "2h", "7d".
func ParseInstant ¶
ParseInstant parses a single point in time relative to now. It accepts:
- "now" → now
- "now-1h" / "now+30m" → now ± duration (supports d/w units)
- a bare duration "1h" / "2d" → that long ago (now - duration)
- RFC3339 / RFC3339 with zone → as written
- "2006-01-02" (UTC midnight) and "2006-01-02 15:04:05" (UTC)
- an integer epoch in seconds, milliseconds or microseconds (auto-detected)