Skip to content

Commit e777c16

Browse files
committed
EC.Time constructor code refactoring
1 parent e4b86dc commit e777c16

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bson/constructor.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,9 +341,9 @@ func (ElementConstructor) DateTime(key string, dt int64) *Element {
341341
}
342342

343343
// Time creates a datetime element with the given key and value.
344-
func (c ElementConstructor) Time(key string, time time.Time) *Element {
344+
func (c ElementConstructor) Time(key string, t time.Time) *Element {
345345
// Apply nanoseconds to milliseconds conversion
346-
return c.DateTime(key, time.UnixNano()/1e6)
346+
return c.DateTime(key, t.UnixNano()/int64(time.Millisecond))
347347
}
348348

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

0 commit comments

Comments
 (0)