BSONTimestamp loses precision

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Minor - P4
    • None
    • Affects Version/s: 2.9.0
    • Component/s: API
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      For a reason unfathomable to me, the API for BSONTimestamp uses seconds, both for the constructor and for getTime(), even though the actual BSON type is in milliseconds. Since the type is an integer, this means that any millisecond precision is lost in the Java driver.

      Please fix this to use milliseconds!

      For backwards API compatibility, I suggest the following:

      1. A second constructor: BSONTimestamp(int t, int i, boolean isMilliseconds) - the old constructor would just call this with isMilliseconds=false
      2. Leave getTime as it is, but add getTimeMilliseconds which will return the time without dividing by 1000

            Assignee:
            Unassigned
            Reporter:
            Tal Liron
            None
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: