Skip to content

Instantly share code, notes, and snippets.

@kohnakagawa
Last active December 29, 2015 04:09
Show Gist options
  • Save kohnakagawa/7612986 to your computer and use it in GitHub Desktop.
Save kohnakagawa/7612986 to your computer and use it in GitHub Desktop.
#include <sys/time.h>
double time_dif(timeval &tv1, timeval &tv2)
{
const double dt = tv2.tv_sec - tv1.tv_sec + (tv2.tv_usec - tv1.tv_usec) * 1.0e-6;
return dt;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment