using timer with glx?

I am using glx to develop opengl program, how can I add a timer to my opengl window so that I can implement an animation?

this is not an advanced question;

do ‘man gettimeofday’

cheers,
John