Using only UnixNano to convert time.Time to MongoDB Datetimes misses large amounts of possible datetimes

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Duplicate
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: BSON
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      https://github.com/mongodb/mongo-go-driver/search?q=UnixNano&unscoped_q=UnixNano

      Using UnixNano results in underflow for large and small dates (dates sufficiently far from January 1st, 1970). The following calculation should be used instead:

      return t.Unix()*1000 + int64(t.Nanosecond()/1e6)
      

              Assignee:
              Unassigned
              Reporter:
              Patrick Meredith
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: