Created
July 18, 2019 15:36
-
-
Save raldone01/b8a3e420be776f93aa17728aa318eb00 to your computer and use it in GitHub Desktop.
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
timespec timespecDiff(timespec start, timespec stop) { | |
timespec ret; | |
ret.tv_sec = stop.tv_sec - start.tv_sec; | |
if(start.tv_nsec > stop.tv_nsec) { | |
ret.tv_nsec = 1000000000 - start.tv_nsec + stop.tv_nsec; | |
ret.tv_sec--; | |
} else | |
ret.tv_nsec = stop.tv_nsec - start.tv_nsec; | |
return ret; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment