Added Util::getNTP() to timing library.
This commit is contained in:
parent
54c31922f7
commit
6c54546048
2 changed files with 7 additions and 0 deletions
|
@ -35,6 +35,12 @@ void Util::sleep(int ms){
|
|||
nanosleep( &T, 0);
|
||||
}
|
||||
|
||||
long long Util::getNTP(){
|
||||
struct timespec t;
|
||||
clock_gettime(CLOCK_REALTIME, &t);
|
||||
return ((((long long int)t.tv_sec) + 2208988800) << 32) + (t.tv_nsec*4.2949);
|
||||
}
|
||||
|
||||
/// Gets the current time in milliseconds.
|
||||
long long int Util::getMS(){
|
||||
struct timespec t;
|
||||
|
|
|
@ -8,5 +8,6 @@ namespace Util {
|
|||
long long int getMS(); ///< Gets the current time in milliseconds.
|
||||
long long unsigned int getMicros();///<Gets the current time in microseconds.
|
||||
long long unsigned int getMicros(long long unsigned int previous);///<Gets the time difference in microseconds.
|
||||
long long int getNTP();
|
||||
long long int epoch(); ///< Gets the amount of seconds since 01/01/1970.
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue