MotorControlModuleSDFM_TMS3.../Projects/EFC_Communication/UMLibrary/peripheral/NanoTimer.cpp
2024-06-07 11:12:56 +03:00

30 lines
801 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* 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;