Uploaded image for project: 'PHP Driver: Extension'
  1. PHP Driver: Extension
  2. PHPC-1982

Use bson_gettimeofday for Windows compatibility

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 1.11.0
    • None
    • None

    Description

      The following build warning was observed in this AppVeyor build:

      [00:00:31] php_phongo.c
      [00:00:32] C:\projects\mongodb\php_phongo.c(312): warning C4013: 'gettimeofday' undefined; assuming extern returning int
      

      Oddly, there is no such warning for gettimeofday being called from php_phongo_utcdatetime_init_from_current_time in UTCDateTime.c. Perhaps the compiler is just suppressing a duplicate warning message.

      In any event, we can switch over to using bson_gettimeofday() in both of these contexts. That is a portable version of the function for Windows and will fall back to using gettimeofday directly on non-Windows platforms.

      It's also not clear why this is only a warning and not an error for an unresolved symbol. It's possible another library we link with is ultimately defining this and it happens to work. Otherwise, log output and UTCDateTime construction would be fundamentally broken on Windows. We should look into that and confirm as part of this issue's resolution.

      Attachments

        Issue Links

          Activity

            People

              jmikola@mongodb.com Jeremy Mikola
              jmikola@mongodb.com Jeremy Mikola
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: