22 lines
412 B
C++
22 lines
412 B
C++
|
|
/*
|
||
|
|
* utility.cpp
|
||
|
|
*
|
||
|
|
* Created on: Mar 22, 2011
|
||
|
|
* Author: ditlevsen
|
||
|
|
*/
|
||
|
|
|
||
|
|
#include <sys/time.h>
|
||
|
|
#include <sys/types.h>
|
||
|
|
#include <cstdlib>
|
||
|
|
|
||
|
|
// get time stamp in seconds using Native Linux Time Measurement
|
||
|
|
double get_timestamp() {
|
||
|
|
struct timeval tp;
|
||
|
|
double sec, usec;
|
||
|
|
gettimeofday(&tp, NULL);
|
||
|
|
sec = static_cast<double>( tp.tv_sec );
|
||
|
|
usec = static_cast<double>( tp.tv_usec )/1E6;
|
||
|
|
return sec + usec;
|
||
|
|
}
|
||
|
|
|