Hello, compiling the enclosed code witn Pelles C V8 RC7 with the following options:
-std:C11 -Tx64-coff -MT -Ot -Ob1 -fp:precise -W1 -Gr#
#include <stdio.h>
#include <time.h>
int main(int argc, char *argv[])
{
struct timespec Time;
char string[100];
while ((string[0]!='Q')&&(string[0]!='q')){
timespec_get(&Time,TIME_UTC);
printf("seconds=%ld, nanoseconds=%ld",Time.tv_sec,Time.tv_nsec);
printf("\nEnter something starting with 'Q' to quit:\n");
gets_s(string,sizeof(string));
}
return 0;
}
The compiler says warning #2018: Undeclared function 'gets_s'. I have verified that the function is properly defined in stdio.h. The linker finds the function without problems.
The timespec_get function always returns zero nanoseconds as can be seen by running the sample program. However the _ftime function works ok.
Finally, if the option -MT is removed then the linker doesn't find the timespec_get function.
I am linking with the following options:
-subsystem:console -machine:x64 kernel32.lib advapi32.lib delayimp64.lib
The test was performed under Windows 8.1 64.