Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-2945

Add public function for converting from BSON dates to ISO8601 strings

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

      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).

            Unassigned Unassigned
            stephen.steneker@mongodb.com Stennie Steneker (Inactive)
            1 Vote for this issue
            3 Start watching this issue