Skip to content

Instantly share code, notes, and snippets.

@zhangyuchi
Created November 14, 2014 06:16
Show Gist options
  • Save zhangyuchi/5b8e45fcb65470e854fd to your computer and use it in GitHub Desktop.
Save zhangyuchi/5b8e45fcb65470e854fd to your computer and use it in GitHub Desktop.
get high jingdu time
#define _POSIX_C_SOURCE 199309L /*note it*/
#include <time.h>
#include <stdio.h>
int main()
{
float f=123.013;
for(int j=0; j<2; ++j)
{
for(int i=0; i<10; ++i)
{
struct timespec tp;
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &tp);
printf("clock=%d ", tp.tv_nsec);
}
printf("\n");
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment