[SDL] Add a timestamp to events

Bob Pendleton bob at pendleton.com
Wed Jul 27 22:59:07 PDT 2011


On Wed, Jul 27, 2011 at 11:19 PM, Ryan C. Gordon <icculus at icculus.org> wrote:
>
>> So, yes, all events that can reasonably have time stamps should have
>> times stamps. Ideally timestamps should represent the current GMT
>> accurate to at least a nanosecond and never rap... so about 128 bits
>> should do. :-) Ok.... so seriously, the time stamp should be either a
>> struct timeval (microsecond precision) or a struct timespec
>> (nanosecond precision) or their cross platform equivalent.
>
> I think this should be added, with the caveat that systems that don't
> provide their own timestamps will just get the current SDL_GetTicks()
> assigned to it.

Yep. Sounds right to me.  I've had to do that in the past. I'd just
multiply them by 1000 to convert the ticks to microseconds so you have
a valid value to stuff in a timeval.

Bob Pendleton

>
> --ryan.
>
> _______________________________________________
> SDL mailing list
> SDL at lists.libsdl.org
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>



-- 
+-----------------------------------------------------------
+ Bob Pendleton: writer and programmer
+ email: Bob at Pendleton.com
+ web: www.TheGrumpyProgrammer.com



More information about the SDL mailing list