Mercurial > dropbear
comparison dbutil.c @ 1468:b528e3753af4
define CLOCK_MONOTONIC if needed
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Thu, 08 Feb 2018 22:07:59 +0800 |
parents | fb90a5ba84e0 |
children | 2d450c1056e3 |
comparison
equal
deleted
inserted
replaced
1467:7279a633cc50 | 1468:b528e3753af4 |
---|---|
632 /* CLOCK_MONOTONIC_COARSE was added in Linux 2.6.32 but took a while to | 632 /* CLOCK_MONOTONIC_COARSE was added in Linux 2.6.32 but took a while to |
633 reach userspace include headers */ | 633 reach userspace include headers */ |
634 #ifndef CLOCK_MONOTONIC_COARSE | 634 #ifndef CLOCK_MONOTONIC_COARSE |
635 #define CLOCK_MONOTONIC_COARSE 6 | 635 #define CLOCK_MONOTONIC_COARSE 6 |
636 #endif | 636 #endif |
637 /* Some old toolchains know SYS_clock_gettime but not CLOCK_MONOTONIC */ | |
638 #ifndef CLOCK_MONOTONIC | |
639 #define CLOCK_MONOTONIC 1 | |
640 #endif | |
637 static clockid_t get_linux_clock_source() { | 641 static clockid_t get_linux_clock_source() { |
638 struct timespec ts; | 642 struct timespec ts; |
639 if (syscall(SYS_clock_gettime, CLOCK_MONOTONIC_COARSE, &ts) == 0) { | 643 if (syscall(SYS_clock_gettime, CLOCK_MONOTONIC_COARSE, &ts) == 0) { |
640 return CLOCK_MONOTONIC_COARSE; | 644 return CLOCK_MONOTONIC_COARSE; |
641 } | 645 } |