示例#1
0
std::uint64_t timer_get_nanoseconds()
{
	auto time = get_performance_counter();

	if (Timer_perf_counter_freq < NANOSECONDS_PER_SECOND) {
		// This can cause overflows but I don't know a better solution...
		return (time * NANOSECONDS_PER_SECOND) / Timer_perf_counter_freq;
	} else {
		return time / (Timer_perf_counter_freq / NANOSECONDS_PER_SECOND);
	}
}
示例#2
0
std::uint64_t timer_get_microseconds()
{
	auto time = get_performance_counter();

	return (time * MICROSECONDS_PER_SECOND) / Timer_perf_counter_freq;
}