mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 12:20:41 +00:00
use CLOCK_MONOTONIC maybe better
This commit is contained in:
@@ -247,15 +247,8 @@ static uint64_t
|
|||||||
gettime() {
|
gettime() {
|
||||||
uint64_t t;
|
uint64_t t;
|
||||||
#if !defined(__APPLE__)
|
#if !defined(__APPLE__)
|
||||||
|
|
||||||
#ifdef CLOCK_MONOTONIC_RAW
|
|
||||||
#define CLOCK_TIMER CLOCK_MONOTONIC_RAW
|
|
||||||
#else
|
|
||||||
#define CLOCK_TIMER CLOCK_MONOTONIC
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct timespec ti;
|
struct timespec ti;
|
||||||
clock_gettime(CLOCK_TIMER, &ti);
|
clock_gettime(CLOCK_MONOTONIC, &ti);
|
||||||
t = (uint64_t)ti.tv_sec * 100;
|
t = (uint64_t)ti.tv_sec * 100;
|
||||||
t += ti.tv_nsec / 10000000;
|
t += ti.tv_nsec / 10000000;
|
||||||
#else
|
#else
|
||||||
|
|||||||
Reference in New Issue
Block a user