📄 spnktime.cpp
字号:
/* * Copyright 2008 Stephen Liu * For license terms, see the file COPYING along with this library. */#include <sys/time.h>#include <stdio.h>#include "spnktime.hpp"SP_NKClock :: SP_NKClock(){ gettimeofday ( &mBornTime, NULL ); gettimeofday ( &mPrevTime, NULL ); }SP_NKClock :: ~SP_NKClock(){}long SP_NKClock :: getAge(){ struct timeval now; gettimeofday ( &now, NULL ); return (long)( ( 1000000.0 * ( now.tv_sec - mBornTime.tv_sec ) + ( now.tv_usec - mBornTime.tv_usec ) ) / 1000.0 );}long SP_NKClock :: getInterval(){ struct timeval now; gettimeofday ( &now, NULL ); long ret = long( ( 1000000.0 * ( now.tv_sec - mPrevTime.tv_sec ) + ( now.tv_usec - mPrevTime.tv_usec ) ) / 1000.0 ); mPrevTime = now; return ret;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -