Is this timer efficient?
Is this timer efficient?



Yes, but there are two optimizations that I can see.  Get rid of the goto
and use a do-while loop.  I have noticed a slight performance
increase when it has been written this way in other programs.  

This increase will become non-existent however if you have compiler
optimization settings enabled.  If they are enabled, they compile
into the exact same assembly code.  However, I also find a loop
more readable than a goto, so that is another reason to switch
over.
There other optimization I could see is by cleaning up your if-else a tiny bit (untested).  This should speed up your code a tiny bit (again, if optimizations on your compiler are enabled, your results will vary).

if(now &lt; timer-&gt;tfinal)
{
    required_sleep = ms_to_timespec(timer-&gt;tfinal - now);

    // loop implementation
}
timer-&gt;tfinal += timer-&gt;step;


You may wonder why this will speed up your code.  The more branches you have, the more susceptible you are to a branch prediction failure and those failures can be expensive when it comes to efficiency.




A few other notes:


Use a designated initializer to initialize a structure (C99).

struct timespec temp = 
{ 
    .step = ms / 1000, 
    .tfinal = (ms % 1000) * 1000000 
};

Group your #includes and #defines together in a more organized fashion.

#include &lt;time.h&gt;  // group library headers
#include &lt;errno.h&gt;
#include &lt;stdio.h&gt;
#include "timer.h" // group user defined headers

#define _POSIX_C_SOURCE 199309L  // group defines

Your != 0 comparision check in your if conditional could be removed since it is redundant (the if will always execute if the conditional isn't equal to 0).  However, this may increase readability to you, so it would be okay to keep it.