Add public function for converting from BSON dates to ISO8601 strings

XMLWordPrintableJSON

    • Type: New Feature
    • Resolution: Unresolved
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: libbson
    • None
    • None
    • None
    • None
    • None
    • None

      It looks like the C driver currently doesn't provide a public function for converting from BSON dates to ISO8601 strings. It would be helpful to provide a standard public cross-platform function via the driver API, as standard C library functions like gmtime() do not consistently support dates before the Unix epoch.

      For example, the Windows implementation of the `gmtime()` function currently does not support dates earlier than 1970:

      If sourceTime represents a date before midnight, January 1, 1970, *gmtime* returns *NULL*. There is no error return.

      A suggested approach on Windows would be to fallback to SYSTEMTIME using the Windows API instead of C API: https://docs.microsoft.com/en-us/windows/desktop/Intl/retrieving-time-and-date-information (GetTimeFormatEx, GetDateFormatEx).

            Assignee:
            Unassigned
            Reporter:
            Stennie Steneker (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: