GUACAMOLE-239: Merge support for CLOCK_MONOTONIC.
This commit is contained in:
commit
039a1c52e4
@ -33,9 +33,13 @@ guac_timestamp guac_timestamp_current() {
|
|||||||
|
|
||||||
struct timespec current;
|
struct timespec current;
|
||||||
|
|
||||||
/* Get current time */
|
/* Get current time, monotonically increasing */
|
||||||
|
#ifdef CLOCK_MONOTONIC
|
||||||
|
clock_gettime(CLOCK_MONOTONIC, ¤t);
|
||||||
|
#else
|
||||||
clock_gettime(CLOCK_REALTIME, ¤t);
|
clock_gettime(CLOCK_REALTIME, ¤t);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Calculate milliseconds */
|
/* Calculate milliseconds */
|
||||||
return (guac_timestamp) current.tv_sec * 1000 + current.tv_nsec / 1000000;
|
return (guac_timestamp) current.tv_sec * 1000 + current.tv_nsec / 1000000;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user