Skip to content

Commit ca78baa

Browse files
committed
GODRIVER-564 Use same time.Time conversion in Encoder and ElementConstructor
1 parent cf1b35a commit ca78baa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

bson/constructor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ func (ElementConstructor) DateTime(key string, dt int64) *Element {
343343
// Time creates a datetime element with the given key and value.
344344
func (c ElementConstructor) Time(key string, t time.Time) *Element {
345345
// Apply nanoseconds to milliseconds conversion
346-
return c.DateTime(key, t.UnixNano()/int64(time.Millisecond))
346+
return c.DateTime(key, convertTimeToInt64(t))
347347
}
348348

349349
// Null creates a null element with the given key.

0 commit comments

Comments
 (0)