I have seen this solution but I am getting the same errors. For a class, we had to switch to the c99 compiler instead of gnu but now timespec seems to be broken. Along with "storage size of timespec isn't known", I am getting a bunch of other errors like "CLOCK_MONOTONIC undeclared", "dereferencing a pointer to incomplete type 'struct timespec'", and unused variable warnings but I assume these would go away once I work out the compiler issue.
I wouldn't imagine there is anything wrong with the way I am declaring timespec variables,
struct timespec startTime;
As this kind of "clock" support isn't C99 but POSIX, it's not enabled by default.
To enable it you want to pass the option
-D_POSIX_C_SOURCE=199309Lto the compiler or put aat very beginning of the source file(s) in question.
See also
man clock_gettimefor reference.