目录:1、获取毫秒时间
1、获取毫秒时间
- #include <stdio.h>
- #include <sys/time.h>
- int main() {
- struct timeval start, end;
- gettimeofday( &start, NULL );
- sleep(3);
- gettimeofday( &end, NULL );
- int timeuse = 1000000 * ( end.tv_sec - start.tv_sec ) + end.tv_usec - start.tv_usec;
- printf("time: %d us\n", timeuse);
- return 0;
- }
参考:博客
时间: 2024-11-10 07:59:20