I making a Localization project Using Arduino and Xbee Zg where i need to measure time in nano second resolution im using arduino due board with 84 Mhz clock and arduino 1.5.2 IDE
im trying to use clock_gettime
function i already included time.h but i get the same
compiling error
clock_gettime
is not declared in this scope
this is just a part of my Distance_Measurement.c file
#include "Distance_Measurement.h"
#include "time.h"
struct timespec start, stop;
bool Start_Time()
{
if(clock_gettime(CLOCK_REALTIME,&start) == -1)
return false;
else
return true;
}
bool Stop_Time()
{
if(clock_gettime(CLOCK_REALTIME,&stop) == -1)
return false;
else
return true;
}
double Cal_Time_Nano()
{
return (stop_time.tv_nsec - start_time.tv_nsec);
}
please help me
i first used #include i got the same error i have found that visual studio have included anther time.h not time.h in arduino gcc so i copied the last one and pasted it to arduino libraries path with my distance measurement library – PrinceOfEgy