~sircmpwn/hare

hare/rt/+test/+linux.ha -rw-r--r-- 384 bytes
0db89b74Alexey Yerin shlex: correctly handle leading whitespace 5 hours ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
let start: timespec = timespec { ... };

fn time_start() void = {
	clock_gettime(CLOCK_MONOTONIC, &start) as void;
};

// Returns elapsed time as (seconds, milliseconds)
fn time_stop() (size, size) = {
	let end: timespec = timespec { ... };
	clock_gettime(CLOCK_MONOTONIC, &end) as void;
	return ((end.tv_sec - start.tv_sec): size,
		(end.tv_nsec - start.tv_nsec): size / 10000z);
};