blob: 71484e53b2a9a972fdaccbfceba255f2200a21ee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#include "common.h"
#include <time.h>
char *va(const char *fmt, ...)
{
va_list vl;
static char buffer[4096];
va_start(vl, fmt);
vsnprintf(buffer, sizeof(buffer), fmt, vl);
va_end(vl);
return buffer;
}
int64_t get_time(void)
{
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
return ts.tv_sec * 1000000000 + ts.tv_nsec;
}
|