git.samba.org
/
metze
/
samba
/
wip.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
63b1f2e
)
lib/util: add function to query the monotonic clock with the required fallback to...
author
Björn Jacke
<bj@sernet.de>
Mon, 30 Aug 2010 10:10:29 +0000
(12:10 +0200)
committer
Björn Jacke
<bj@sernet.de>
Tue, 31 Aug 2010 08:25:03 +0000
(10:25 +0200)
lib/util/time.c
patch
|
blob
|
history
lib/util/time.h
patch
|
blob
|
history
diff --git
a/lib/util/time.c
b/lib/util/time.c
index 571219b810b52408b06231183e72091da847423c..5557346b9b035f5544974a6c4255dd2267efe75f 100644
(file)
--- a/
lib/util/time.c
+++ b/
lib/util/time.c
@@
-55,6
+55,16
@@
_PUBLIC_ void GetTimeOfDay(struct timeval *tval)
#endif
}
#endif
}
+/**
+a wrapper to preferably get the monotonic time
+**/
+_PUBLIC_ void clock_gettime_mono(struct timespec *tp)
+{
+ if (clock_gettime(CUSTOM_CLOCK_MONOTONIC,tp) != 0) {
+ clock_gettime(CLOCK_REALTIME,tp);
+ }
+}
+
#define TIME_FIXUP_CONSTANT 11644473600LL
#define TIME_FIXUP_CONSTANT 11644473600LL
diff --git
a/lib/util/time.h
b/lib/util/time.h
index cf6dc1caa7584f722e656f4a1e39dbfd3feb72c2..90890cdbc81f7f3ef51461b1cb3ff7da9e240a92 100644
(file)
--- a/
lib/util/time.h
+++ b/
lib/util/time.h
@@
-50,6
+50,11
@@
a gettimeofday wrapper
**/
_PUBLIC_ void GetTimeOfDay(struct timeval *tval);
**/
_PUBLIC_ void GetTimeOfDay(struct timeval *tval);
+/**
+a wrapper to preferably get the monotonic time
+**/
+_PUBLIC_ void clock_gettime_mono(struct timespec *tp);
+
/**
interpret an 8 byte "filetime" structure to a time_t
It's originally in "100ns units since jan 1st 1601"
/**
interpret an 8 byte "filetime" structure to a time_t
It's originally in "100ns units since jan 1st 1601"