2 つの異なるインスタンス間の時間差を出力するこのプログラムがありますが、秒単位の精度で出力されます。ミリ秒単位で印刷し、ナノ秒単位で印刷したいと思います。
//Prints in accuracy of seconds
#include <stdio.h>
#include <time.h>
int main(void)
{
time_t now, later;
double seconds;
time(&now);
sleep(2);
time(&later);
seconds = difftime(later, now);
printf("%.f seconds difference", seconds);
}
どうすればそれを達成できますか?