Skip to content

Conversation

ShaneHarvey
Copy link
Member

No description provided.

@ShaneHarvey ShaneHarvey requested a review from behackett July 9, 2018 22:05
dtm = dtm - dtm.utcoffset()
return int(calendar.timegm(dtm.timetuple()) * 1000 +
dtm.microsecond / 1000)
dtm.microsecond // 1000)
Copy link
Member Author

@ShaneHarvey ShaneHarvey Jul 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should line 822 also use // in seconds = (millis - diff) / 1000 ?

dt1 = datetime.datetime(9999, 1, 1, 1, 1, 1, 999999)
dt2 = BSON.encode({"date": dt1}).decode()["date"]
self.assertEqual(dt2.microsecond, 999000)
self.assertEqual(dt2.second, dt1.second)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can reproduce this on Windows with 32-bit and 64-bit Python 3.X. So this fix does actually work.

@ShaneHarvey ShaneHarvey merged commit 7ca0499 into mongodb:master Jul 9, 2018
ShaneHarvey added a commit to ShaneHarvey/mongo-python-driver that referenced this pull request Jul 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants