mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
time: don't try to use the coarse clock
as we prefer to use the suspend aware CLOCK_BOOTTIME as monotonic clock source we cannot deal with the mono coarse clock any more. Actually I never saw a real performance gain with it. Signed-off-by: Björn Jacke <bj@sernet.de> Reviewed-by: Simo Sorce <idra@samba.org>
This commit is contained in:
parent
2bdaf532cd
commit
e3c2dd13d4
@ -69,19 +69,12 @@ _PUBLIC_ void clock_gettime_mono(struct timespec *tp)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
a wrapper to preferably get the monotonic time in seconds
|
a wrapper to preferably get the monotonic time in seconds
|
||||||
as this is only second resolution we can use the cached
|
|
||||||
(and much faster) COARSE clock variant
|
|
||||||
**/
|
**/
|
||||||
_PUBLIC_ time_t time_mono(time_t *t)
|
_PUBLIC_ time_t time_mono(time_t *t)
|
||||||
{
|
{
|
||||||
struct timespec tp;
|
struct timespec tp;
|
||||||
int rc = -1;
|
|
||||||
#ifdef CLOCK_MONOTONIC_COARSE
|
|
||||||
rc = clock_gettime(CLOCK_MONOTONIC_COARSE,&tp);
|
|
||||||
#endif
|
|
||||||
if (rc != 0) {
|
|
||||||
clock_gettime_mono(&tp);
|
clock_gettime_mono(&tp);
|
||||||
}
|
|
||||||
if (t != NULL) {
|
if (t != NULL) {
|
||||||
*t = tp.tv_sec;
|
*t = tp.tv_sec;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user