Skip to content

Commit 28f4dc5

Browse files
committed
Improved EC.Time test (use milliseconds precision)
1 parent af54a1d commit 28f4dc5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

bson/constructor_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,14 +279,14 @@ func TestConstructor(t *testing.T) {
279279
// key
280280
0x66, 0x6f, 0x6f, 0x0,
281281
// value
282-
0xC8, 0x6C, 0x3C, 0xAF, 0x60, 0x1, 0x0, 0x0,
282+
0xC9, 0x6C, 0x3C, 0xAF, 0x60, 0x1, 0x0, 0x0,
283283
}
284284

285285
expected := &Element{&Value{start: 0, offset: 5, data: buf, d: nil}}
286286

287-
date := time.Date(2018, 1, 1, 1, 1, 1, 1, time.UTC)
287+
date := time.Date(2018, 1, 1, 1, 1, 1, int(1*time.Millisecond), time.UTC)
288288
actualTime := EC.Time("foo", date)
289-
actualDateTime := EC.DateTime("foo", date.Unix()*1000)
289+
actualDateTime := EC.DateTime("foo", date.UnixNano()/1e6)
290290

291291
requireElementsEqual(t, expected, actualTime)
292292
requireElementsEqual(t, expected, actualDateTime)

0 commit comments

Comments
 (0)