clock_gettime() not compiling

comperem
Posts: 4
Joined: Sat Jan 25, 2020 8:08 pm

clock_gettime() not compiling

Postby comperem » Fri Feb 07, 2020 3:56 pm

Hello,
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);
}
How can I get this to compile?

ySh_zZpp
Posts: 5
Joined: Wed Apr 06, 2022 3:15 am

Re: clock_gettime() not compiling

Postby ySh_zZpp » Sat Apr 16, 2022 1:45 am

同样的情况 ,请问解决了么?

Who is online

Users browsing this forum: Majestic-12 [Bot] and 336 guests