I cannot get the Arduino IDE to find and compile `clock_gettime()`.
My error is: `'clock_gettime' was not declared in this scope`
Here's the simple sketch:
Code: Select all
#include "time.h"
struct timespec tp;
void setup()
{
Serial.begin(115200);
}
void loop()
{
double tNow;
long dt_sec, dt_nsec;
clock_gettime(CLOCK_REALTIME, &tp);
tNow = tp.tv_sec+(tp.tv_nsec/1.0e9);
Serial.print("tNow=,%20.10f, tNow_sec=,%16.10ld, tNow_nsec=,%16.10ld, dt_sec=%16li(s), dt_nsec=%16li(s)", tNow, tp.tv_sec,tp.tv_nsec, dt_sec, dt_nsec);
delay(1000);
}