timespec
This commit is contained in:
@@ -51,7 +51,8 @@ static mcc_errcodes_t shortcmd(short_command_t *cmd);
|
||||
|
||||
/**
|
||||
* @brief nanotime - monotonic time from first run
|
||||
* @return time in seconds
|
||||
* @return struct timespec by CLOCK_MONOTONIC but with setpoint by CLOCK_REALTIME on observations start
|
||||
* FIXME: double -> struct timespec; on init: init t0 by CLOCK_REALTIME
|
||||
*/
|
||||
double nanotime(){
|
||||
static double t0 = -1.;
|
||||
@@ -63,6 +64,7 @@ double nanotime(){
|
||||
t0 = (double)start.tv_sec + (double)start.tv_nsec * 1e-9
|
||||
- (double)now.tv_sec - (double)now.tv_nsec * 1e-9;
|
||||
}
|
||||
DBG("ASK nanotime: %g", (double)now.tv_sec + (double)now.tv_nsec * 1e-9 + t0);
|
||||
return (double)now.tv_sec + (double)now.tv_nsec * 1e-9 + t0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user