bug fix: on Mac with newest Qt version the ping time was always 0
This commit is contained in:
parent
461650d4e2
commit
6b1541b622
1 changed files with 6 additions and 2 deletions
|
@ -43,7 +43,11 @@ using namespace std; // because of the library: "vector"
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
# include <mmsystem.h>
|
# include <mmsystem.h>
|
||||||
#elif !defined ( __APPLE__ ) && !defined ( __MACOSX )
|
#elif defined ( __APPLE__ ) || defined ( __MACOSX )
|
||||||
|
# include <mach/mach.h>
|
||||||
|
# include <mach/mach_error.h>
|
||||||
|
# include <mach/mach_time.h>
|
||||||
|
#else
|
||||||
# include <sys/time.h>
|
# include <sys/time.h>
|
||||||
#endif
|
#endif
|
||||||
#include "ui_aboutdlgbase.h"
|
#include "ui_aboutdlgbase.h"
|
||||||
|
@ -1037,7 +1041,7 @@ public:
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
return timeGetTime();
|
return timeGetTime();
|
||||||
#elif defined ( __APPLE__ ) || defined ( __MACOSX )
|
#elif defined ( __APPLE__ ) || defined ( __MACOSX )
|
||||||
return QTime().elapsed();
|
return mach_absolute_time() / 1000000; // convert ns in ms
|
||||||
#else
|
#else
|
||||||
timespec tp;
|
timespec tp;
|
||||||
clock_gettime ( CLOCK_MONOTONIC, &tp );
|
clock_gettime ( CLOCK_MONOTONIC, &tp );
|
||||||
|
|
Loading…
Add table
Reference in a new issue