[GODRIVER-884] Default for timestamps is a zero'd *time.Location, instead of `nil` Created: 18/Mar/19  Updated: 28/Oct/23  Resolved: 10/Apr/19

Status: Closed
Project: Go Driver
Component/s: BSON
Affects Version/s: 1.0.0
Fix Version/s: 1.0.1

Type: Bug Priority: Major - P3
Reporter: Jeremy Loy Assignee: Kristofer Brandow (Inactive)
Resolution: Fixed Votes: 0
Labels: evg
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
backported by GODRIVER-949 Backport "Default for timestamps is a... Closed
Duplicate
is duplicated by GODRIVER-923 zero time values should not loose tim... Closed

 Description   

We are currently in the process of migrating away from `mgo`, and to the official driver (thank you for making it!).

In order to perform the migration smoothly, we are writing a suite of parity integration tests, verifying the exact behavior differences between the two libraries. (e.g. reflect.DeepEqual on two objects, one returned from `mgo` the other from official)

One of our parity tests is failing, in regards to time zone translation when marshaling/un-marshaling a Golang `time.Time`.  `mgo` sets the internal `*time.Location` as `nil`, while the official driver sets it to a zero value.

I believe `nil` is actually more correct, as this mirrors what the standard library does. See `time.go#192`. When the time is set to `UTC`, it actually sets `loc` to `nil`.

Because `time.Location` is set to the zero value, this is the representation of the time to default to system location, rather than UTC.



 Comments   
Comment by Githook User [ 10/Apr/19 ]

Author:

{'email': 'kris@mongodb.com', 'name': 'Kris Brandow', 'username': 'skriptble'}

Message: Remove *Location in decoded time.Time values

GODRIVER-884

Change-Id: I1ef785f1ce1e9693e277d41c7a7b4672c411a551
Branch: release/1.0
https://github.com/mongodb/mongo-go-driver/commit/ec0d36bda3be51dbea04ed0d8d96b00184e2ac4e

Comment by Githook User [ 10/Apr/19 ]

Author:

{'name': 'Kris Brandow', 'username': 'skriptble', 'email': 'kris@mongodb.com'}

Message: Remove *Location in decoded time.Time values

GODRIVER-884

Change-Id: I1ef785f1ce1e9693e277d41c7a7b4672c411a551
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/b6330d2a860ca7798aba3e717f9afd08f602a199

Comment by Kristofer Brandow (Inactive) [ 05/Apr/19 ]

Code Review: https://review.gerrithub.io/c/mongodb/mongo-go-driver/+/450300.

Generated at Thu Feb 08 08:35:10 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.