[Mesa-dev] [PATCH 4/7] mesa: implement glGet(GL_TIMESTAMP)

Michel Dänzer michel at daenzer.net
Wed Jun 27 00:29:35 PDT 2012


On Mit, 2012-06-27 at 03:49 +0200, Marek Olšák wrote: 
> 
> +GLuint64
> +_mesa_get_cpu_timestamp(void)
> +{
> +#ifndef _WIN32
> +   struct timeval tv;
> +
> +   gettimeofday(&tv, 0);
> +   return (GLuint64)tv.tv_sec * 1000000000ull + (GLuint64)tv.tv_usec * 1000;

As in a recent discussion about DRM vblank counters, it may be better to
use clock_gettime(CLOCK_MONOTONIC, ...) when possible, as gettimeofday()
can move backwards.


-- 
Earthling Michel Dänzer           |                   http://www.amd.com
Libre software enthusiast         |          Debian, X and DRI developer


More information about the mesa-dev mailing list