Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 16 lines (13 sloc) 0.309 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#include <stdint.h>
#include <stdlib.h>
#include <sys/time.h>
#include "dat.h"

int64
nanoseconds(void)
{
    int r;
    struct timeval tv;

    r = gettimeofday(&tv, 0);
    if (r != 0) return warnx("gettimeofday"), -1; // can't happen

    return ((int64)tv.tv_sec)*1000000000 + ((int64)tv.tv_usec)*1000;
}
Something went wrong with that request. Please try again.