forked from Mirrors/openclonk
cmake: mac: Don't require rt library
parent
f5e7743a77
commit
379836f32c
|
@ -1007,7 +1007,7 @@ if(USE_CONSOLE)
|
|||
${READLINE_LIBRARIES}
|
||||
)
|
||||
endif()
|
||||
if(UNIX)
|
||||
if(UNIX AND NOT APPLE)
|
||||
target_link_libraries(c4group rt)
|
||||
target_link_libraries(c4script rt)
|
||||
target_link_libraries(netpuncher rt)
|
||||
|
|
|
@ -30,14 +30,26 @@ unsigned int GetTime()
|
|||
|
||||
#else
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <sys/time.h>
|
||||
#else
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
unsigned int GetTime()
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
static time_t sec_offset;
|
||||
timeval tv;
|
||||
gettimeofday(&tv, 0);
|
||||
if (!sec_offset) sec_offset = tv.tv_sec;
|
||||
return (tv.tv_sec - sec_offset) * 1000 + tv.tv_usec / 1000;
|
||||
#else
|
||||
timespec tv;
|
||||
clock_gettime(CLOCK_MONOTONIC, &tv);
|
||||
static time_t sec_offset = tv.tv_sec;
|
||||
return (tv.tv_sec - sec_offset) * 1000 + tv.tv_nsec / 1000000;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue