projects
/
bluesky.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add high-resolution timekeeping functions (primarily for benchmarking).
[bluesky.git]
/
bluesky
/
util.c
diff --git
a/bluesky/util.c
b/bluesky/util.c
index
85f6a70
..
6a36169
100644
(file)
--- a/
bluesky/util.c
+++ b/
bluesky/util.c
@@
-15,6
+15,17
@@
/* Miscellaneous useful functions that don't really fit anywhere else. */
/* Miscellaneous useful functions that don't really fit anywhere else. */
+bluesky_time_hires bluesky_now_hires()
+{
+ struct timespec time;
+
+ if (clock_gettime(CLOCK_REALTIME, &time) != 0) {
+ perror("clock_gettime");
+ return 0;
+ }
+
+ return (int64_t)(time.tv_sec) * 1000000000 + time.tv_nsec;
+}
/* Convert a UTF-8 string to lowercase. This can be used to implement
* case-insensitive lookups and comparisons, by normalizing all values to
/* Convert a UTF-8 string to lowercase. This can be used to implement
* case-insensitive lookups and comparisons, by normalizing all values to