summaryrefslogtreecommitdiffstats
path: root/src/shared/timing.c
blob: bdb838868ca116973abc3a3e23765c80775f67e2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <dnbd3/shared/timing.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

struct timespec basetime;

void timing_abort()
{
	printf( "Cannot get CLOCK_MONOTONIC(_RAW), errno=%d\n", errno );
	exit( 1 );
}

void timing_setBase()
{
	if ( clock_gettime( BEST_CLOCK_SOURCE, &basetime ) == -1 ) {
		memset( &basetime, 0, sizeof(basetime) );
	}
}