serval-dna/nacl/nacl-20110221/curvecp/nanoseconds.c
Daniel O'Connor bf9710fd5a Unpacked nacl-20110221 after processing by nacl-prepare-sources.
This only affects build_android, if nacl-gcc-prep is run then build/`uname -s` will be created.
2012-02-27 12:40:14 +10:30

13 lines
341 B
C

#include <time.h>
#include "nanoseconds.h"
/* XXX: Y2036 problems; should upgrade to a 128-bit type for this */
/* XXX: nanosecond granularity limits users to 1 terabyte per second */
long long nanoseconds(void)
{
struct timespec t;
if (clock_gettime(CLOCK_REALTIME,&t) != 0) return -1;
return t.tv_sec * 1000000000LL + t.tv_nsec;
}