📄 clock.c
字号:
/*|| clock.c|||| Functions:|| ResetClock()|| StartClock()|| StopClock()*/#include <sys/types.h>#include <sys/times.h>#include "options.h"#include "index.h"struct tms start, stop, net;extern float UserTime, SystemTime;extern long ElapsedTime;long startElapsed, stopElapsed;ResetClock(){ UserTime = SystemTime = 0; ElapsedTime = 0; net.tms_utime = net.tms_stime = net.tms_cutime = net.tms_cstime = 0;}StartClock(){ long time(); times(&start); startElapsed = time(0);}StopClock(){ long time(); times(&stop); stopElapsed = time(0); net.tms_utime += stop.tms_utime - start.tms_utime; net.tms_stime += stop.tms_stime - start.tms_stime; net.tms_cutime += stop.tms_cutime - start.tms_cutime; net.tms_cstime += stop.tms_cstime - start.tms_cstime; UserTime = (float)net.tms_utime / 60; SystemTime = (float)net.tms_stime / 60; ElapsedTime += stopElapsed - startElapsed;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -