Created
September 19, 2021 20:58
-
-
Save Sporif/314d5796e48ff0e9f63ec5b89f967b66 to your computer and use it in GitHub Desktop.
Allow evhz to detect refresh rates higher than 1000Hz (https://git.sr.ht/~iank/evhz)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/evhz.c b/evhz.c | |
index 3b4d0cf..c7ba33d 100644 | |
--- a/evhz.c | |
+++ b/evhz.c | |
@@ -118,13 +118,13 @@ int main(int argc, char *argv[]) { | |
unsigned long long time, timediff; | |
unsigned hz = 0; | |
- time = (unsigned long long)event.time.tv_sec * 1000ULL; | |
- time += (unsigned long long)event.time.tv_usec / 1000ULL; | |
+ time = (unsigned long long)event.time.tv_sec * 1000000ULL; | |
+ time += (unsigned long long)event.time.tv_usec; | |
timediff = time - events[i].prev_time; | |
if(timediff != 0) | |
- hz = 1000ULL / timediff; | |
+ hz = 1000000ULL / timediff; | |
if(hz > 0) { | |
unsigned j, maxavg; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment