Exemplo n.º 1
0
int
__gettimeofday(struct timeval *tv, struct timezone *tz)
{
	struct timespec ts;
	int res;
	int w;

	if (fast_clock == 0 && fast_count++ >= 10) {
                __kpmap_map(&upticksp, &fast_clock, KPTYPE_UPTICKS);
		__kpmap_map(&ts_realtime, &fast_clock, KPTYPE_TS_REALTIME);
		__kpmap_map(&fast_gtod, &fast_clock, KPTYPE_FAST_GTOD);
		__kpmap_map(NULL, &fast_clock, 0);
	}
	if (fast_clock > 0 && *fast_gtod && tz == NULL) {
		do {
			w = *upticksp;
			cpu_lfence();
			ts = ts_realtime[w & 1];
			cpu_lfence();
			w = *upticksp - w;
		} while (w > 1);
		res = 0;
		if (tv) {
			tv->tv_sec = ts.tv_sec;
			tv->tv_usec = ts.tv_nsec / 1000;
		}
	} else {
		res = __sys_gettimeofday(tv, tz);
	}
	return res;
}
Exemplo n.º 2
0
int
__gettimeofday(struct timeval *tv, struct timezone *tz)
{
	int res;

	res = __sys_gettimeofday(tv, tz);
	return res;
}
Exemplo n.º 3
0
int
__gettimeofday(struct timeval *tv, struct timezone *tz)
{
	int error;

	error = __vdso_gettimeofday(tv, tz);
	if (error == ENOSYS)
		error = __sys_gettimeofday(tv, tz);
	return (error);
}