Skip to content

Instantly share code, notes, and snippets.

@ikcaro
Created July 2, 2013 15:18
Show Gist options
  • Save ikcaro/5910204 to your computer and use it in GitHub Desktop.
Save ikcaro/5910204 to your computer and use it in GitHub Desktop.
Unix time
double getUnixTime()
{
struct timespec tv;
if(clock_gettime(CLOCK_REALTIME, &tv) != 0) return 0;
return (((double) tv.tv_sec) + (double) (tv.tv_nsec / 1000000000.0));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment