分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow
也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!
#include <time.h>// 返回自系统开机以来的毫秒数(tick)unsigned long GetTickCount(){ struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); return (ts.tv_sec * 1000 + ts.tv_nsec / 1000000);}int main(){ struct timespec time1 = { 0, 0 }; clock_gettime(CLOCK_REALTIME, &time1); printf("CLOCK_REALTIME: %d, %d\n", time1.tv_sec, time1.tv_nsec); clock_gettime(CLOCK_MONOTONIC, &time1); printf("CLOCK_MONOTONIC: %d, %d\n", time1.tv_sec, time1.tv_nsec); clock_gettime(CLOCK_MONOTONIC_RAW, &time1); printf("CLOCK_MONOTONIC_RAW: %d, %d\n", time1.tv_sec, time1.tv_nsec); clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &time1); printf("CLOCK_PROCESS_CPUTIME_ID: %d, %d\n", time1.tv_sec, time1.tv_nsec); clock_gettime(CLOCK_THREAD_CPUTIME_ID, &time1); printf("CLOCK_THREAD_CPUTIME_ID: %d, %d\n", time1.tv_sec, time1.tv_nsec); printf("\n%d\n", time(NULL)); printf("tick count in ms: %ul\n", GetTickCount()); return 0;}