Skip to content

Commit

Permalink
cmd/ulid: use Time helper instead of parsing manually (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbourgon authored Feb 12, 2019
1 parent f41f974 commit 2a7d33a
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions cmd/ulid/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,7 @@ func parse(s string, local bool, f func(time.Time) string) {
os.Exit(1)
}

var (
msec = id.Time()
sec = msec / 1e3
rem = msec % 1e3
nsec = rem * 1e6
t = time.Unix(int64(sec), int64(nsec))
)
t := ulid.Time(id.Time())
if !local {
t = t.UTC()
}
Expand Down

0 comments on commit 2a7d33a

Please sign in to comment.