MotorControlModuleSDFM_TMS3.../Projects/EFC_Communication/UMLibrary/peripheral/NanoTimer.cpp

30 lines
801 B
C++
Raw Normal View History

2024-06-07 11:12:56 +03:00
/*
* NanoTimer.cpp
*
* Created on: 27 янв. 2022 г.
* 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;