30 lines
797 B
C++
30 lines
797 B
C++
|
|
/*
|
|||
|
|
* NanoTimer.cpp
|
|||
|
|
*
|
|||
|
|
* Created on: 27 <EFBFBD><EFBFBD><EFBFBD>. 2022 <EFBFBD>.
|
|||
|
|
* Author: titov
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
#include "NanoTimer.hh"
|
|||
|
|
|
|||
|
|
#include <ctime>
|
|||
|
|
|
|||
|
|
peripheral::nanotimer::stamp default_point() {
|
|||
|
|
return std::time( nullptr );
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
peripheral::nanotimer::time_ns default_time( peripheral::nanotimer::stamp a ) {
|
|||
|
|
return ( std::time( nullptr ) - a ) * 1000000ul;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
peripheral::nanotimer::time_ns default_delta( peripheral::nanotimer::stamp start, peripheral::nanotimer::stamp point ) {
|
|||
|
|
return ( point - start ) * 1000000ul;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
peripheral::nanotimer::stamp ( * peripheral::nanotimer::point)() = &default_point;
|
|||
|
|
peripheral::nanotimer::time_ns ( * peripheral::nanotimer::time)( stamp ) = &default_time;
|
|||
|
|
peripheral::nanotimer::time_ns ( * peripheral::nanotimer::delta)( stamp start, stamp point ) = &default_delta;
|
|||
|
|
|
|||
|
|
|
|||
|
|
|