I want to convert milliseconds into timespec structure used by GNU Linux. I have tried following code for the same.
timespec GetTimeSpecValue(unsigned long milisec)
{
struct timespec req;
//long sec = (milisecondtime /1000);
time_t sec = (time_t)(milisec/1000);
req->tv_sec = sec;
req->tv_nsec = 0;
return req;
}
Running this code gives me the following error.
expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘GetTimeSpecValue’
I have also include time.h file in the code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With