Ticket #62061: wireshark3-patch-fix-clock_realtime.diff

File wireshark3-patch-fix-clock_realtime.diff, 976 bytes (added by mascguy (Christopher Nielsen), 4 years ago)
  • ui/qt/import_text_dialog.cpp

     
    1111
    1212#include <time.h>
    1313
     14#ifdef __MACH__
     15#include <mach/clock.h>
     16#include <mach/mach.h>
     17#endif
     18
    1419#include "import_text_dialog.h"
    1520
    1621#include "wiretap/wtap.h"
     
    384389
    385390#ifdef _WIN32
    386391            timespec_get(&timenow, TIME_UTC); /* supported by Linux and Windows */
     392#elif defined(__MACH__)
     393            // OS X does not have clock_gettime, use clock_get_time
     394            clock_serv_t cclock;
     395            mach_timespec_t mts;
     396            host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
     397            clock_get_time(cclock, &mts);
     398            mach_port_deallocate(mach_task_self(), cclock);
     399            timenow.tv_sec = mts.tv_sec;
     400            timenow.tv_nsec = mts.tv_nsec;
    387401#else
    388402            clock_gettime(CLOCK_REALTIME, &timenow); /* supported by Linux and MacOS */
    389403#endif