Skip to content

Instantly share code, notes, and snippets.

@chmike
Created December 12, 2012 09:27
Show Gist options
  • Save chmike/4266372 to your computer and use it in GitHub Desktop.
Save chmike/4266372 to your computer and use it in GitHub Desktop.

Revisions

  1. chmike created this gist Dec 12, 2012.
    9 changes: 9 additions & 0 deletions GetTimeAsDouble.h
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    #include <sys/time.h>

    // Return the current time as a double float in second units
    double getTimeAsDouble()
    {
    struct timeval t;
    ::gettimeofday( &t, NULL );
    return double(t.tv_sec) + double(t.tv_usec)/1000000.0;
    }