Skip to content

Instantly share code, notes, and snippets.

View raldone01's full-sized avatar

raldone01

View GitHub Profile
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;
}