Skip to content

Commit

Permalink
clock: Add MustParse (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunshineplan committed Jan 15, 2024
1 parent 37dc592 commit 39d4144
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions clock/clock.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ func Parse(v string) (Clock, error) {
return Clock{}, fmt.Errorf("cannot parse %q as clock", v)
}

func MustParse(v string) Clock {
if c, err := Parse(v); err != nil {
panic("clock: " + err.Error())
} else {
return c
}
}

func ParseTime(t time.Time) Clock {
return New(t.Clock())
}
Expand Down

0 comments on commit 39d4144

Please sign in to comment.