We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2958

Summary: For event timestamps, use high precision counter
Product: SDL Reporter: Mike Lawrence <mike.lwrnc>
Component: eventsAssignee: Sam Lantinga <slouken>
Status: RESOLVED WONTFIX QA Contact: Sam Lantinga <slouken>
Severity: enhancement    
Priority: P2    
Version: HG 2.1   
Hardware: All   
OS: All   
Attachments: diff for suggested path

Description Mike Lawrence 2015-04-23 18:17:38 UTC
Created attachment 2131 [details]
diff for suggested path

Simply requires replacement of "SDL_GetTicks()" with "SDL_GetPerformanceCounter()" in events/SDL_events.c and replacement of all instances of "Uint32 timestamp" with "Uint64 timestamp" in include/SDL_events.h. Diff for patch attached.
Comment 1 Sam Lantinga 2016-10-08 00:31:57 UTC
Out of curiosity, what use case do you have for < 1ms resolution on the event timestamp, given that the timestamp is only when the last SDL_PumpEvents() call was made?
Comment 2 Mike Lawrence 2019-10-18 14:19:15 UTC
(I thought I responded to Sam's question way back in 2016, but happeened across thread in my email just now and see that my response bounced, so I'm posting my response now)

I do cognitive science research that often involves measuring human response times where phenomena of interest may be on the order of merely several milliseconds. A higher precision event timestamp well help reduce noise and thereby improve statistical power. 

Note I've actually started using pyusb in a completely separate process to collect responses and their timestamps, so having the higher precision event timestamps in SDL isn't a big deal for me personally any more.
Comment 3 Sam Lantinga 2019-11-17 06:39:32 UTC
Okay, thanks for the update!