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

Add public function for converting from BSON dates to ISO8601 strings

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Open
    • Priority: Major - P3
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: libbson
    • Labels:
      None

      Description

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

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            stennie Stennie Steneker
            Participants:
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: