nanosleep library issue
Posted: Sat Oct 27, 2018 3:19 pm
Hello,
I would like to use nanosleep() function but I got this error on compile:
error: implicit declaration of function 'nanosleep' [-Werror=implicit-function-declaration]
nanosleep(&tim , &tim2);
^
My code looks like this:
time.h is included and I am not sure ESP-IDF has an alternate.
Any help are welcome!
Regards,
Arpi
I would like to use nanosleep() function but I got this error on compile:
error: implicit declaration of function 'nanosleep' [-Werror=implicit-function-declaration]
nanosleep(&tim , &tim2);
^
My code looks like this:
Code: Select all
#include "sdkconfig.h"
#include <stdio.h>
#include <time.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_system.h"
#include "esp_spi_flash.h"
#include "soc/cpu.h"
#include "esp_clk.h"
void app_main()
{
int clock_freq = esp_clk_cpu_freq();
printf("CPU Freq %d \n", clock_freq);
struct timespec tim, tim2;
tim.tv_sec =0;
tim.tv_nsec = 500000000L;
nanosleep(&tim , &tim2);
fflush(stdout);
esp_restart();
return;
}
Any help are welcome!
Regards,
Arpi