diff options
Diffstat (limited to 'nacl/curvecp/nanoseconds.c')
-rw-r--r-- | nacl/curvecp/nanoseconds.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/nacl/curvecp/nanoseconds.c b/nacl/curvecp/nanoseconds.c new file mode 100644 index 00000000..158ff402 --- /dev/null +++ b/nacl/curvecp/nanoseconds.c | |||
@@ -0,0 +1,12 @@ | |||
1 | #include <time.h> | ||
2 | #include "nanoseconds.h" | ||
3 | |||
4 | /* XXX: Y2036 problems; should upgrade to a 128-bit type for this */ | ||
5 | /* XXX: nanosecond granularity limits users to 1 terabyte per second */ | ||
6 | |||
7 | long long nanoseconds(void) | ||
8 | { | ||
9 | struct timespec t; | ||
10 | if (clock_gettime(CLOCK_REALTIME,&t) != 0) return -1; | ||
11 | return t.tv_sec * 1000000000LL + t.tv_nsec; | ||
12 | } | ||