aboutsummaryrefslogtreecommitdiffstats
path: root/openbsd-compat/res_randomid.c
blob: c848c41d222427607fd424a7af6a6eee3bc8570c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
#include "includes.h"

#include <time.h>

unsigned int
res_randomid(void)
{
	struct timespec ts;

	/* This is from musl C library */
	clock_gettime(CLOCK_MONOTONIC, &ts);
	return ts.tv_nsec + ts.tv_nsec / 65536UL & 0xffff;
}