package interval
import "github.com/google/monologue/interval"
Package interval provides a struct representing a time interval.
Index ¶
Types ¶
type Interval ¶
Interval represents the interval [Start, End).
func (*Interval) RandomSecond ¶
RandomSecond returns a random second-precision time that falls within the Interval.
If there is no second-precision time that falls in the Interval, the zero value time.Time will be returned. For example:
Start = 2019-03-25 00:00:00.1 +0000 UTC End = 2019-03-25 00:00:00.9 +0000 UTC
If Interval.End == Interval.Start, the zero value time.Time will be returned. This is because an Interval represents the interval [Interval.Start, Interval.End), so if Interval.Start and Interval.End are equal, the interval is invalid.
If Interval.End < Interval.Start, the zero value time.Time will be returned.
If the Interval is nil, the zero value time.Time will be returned.
Source Files ¶
- Version
- v0.0.0-20230315160450-1dc62842925e (latest)
- Published
- Mar 15, 2023
- Platform
- linux/amd64
- Imports
- 2 packages
- Last checked
- 1 day ago –
Tools for package owners.