Skip to content

Commit

Permalink
fix(time): unix() and unix_nano() returns 0 for epoch
Browse files Browse the repository at this point in the history
Time zero value is "0001-01-01T00:00:00Z". Tests expected zero
value have unix()/unix_nano() to be 0, but this is only the case
for epoch.
  • Loading branch information
matslina authored and b5 committed Jun 19, 2020
1 parent c32c667 commit c50ebc2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions time/testdata/test.star
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ assert.eq(10.0, d2.hours())
assert.eq(10*60.0, d2.minutes())
assert.eq(10*60*60.0, d2.seconds())
assert.eq(10*60*60*1000000000, d2.nanoseconds())
assert.eq(time.zero.unix(), 0)
assert.eq(time.zero.unix_nano(), 0)
assert.eq(time.time("1970-01-01T00:00:00Z").unix(), 0)
assert.eq(time.time("1970-01-01T00:00:00Z").unix_nano(), 0)

time.sleep(time.second)

0 comments on commit c50ebc2

Please sign in to comment.