📄 timer.cc
字号:
//// timer.cc - A stopwatch//// author: J.I.v.Hemert// last updated : 10-10-1997//// This file implements the class TimerC.//#include "timer.h"void TimerC::Reset (){#ifdef Linux struct timeb tmp; ftime (&tmp); start = tmp.time;#endif#ifdef IRIX start = time (0);#endif} // Reset ()int TimerC::GetTime (){#ifndef SunOS#ifdef Linux struct timeb tmp; ftime (&tmp); return (tmp.time);#endif#ifdef IRIX return (time (0));#endif#else return (0);#endif} // GetTime ()void TimerC::Print (ofstream & stream){#ifndef SunOS double elapsed;#if defined(Linux) struct timeb tmp; ftime (&tmp); elapsed = difftime (tmp.time, start);#endif#ifdef IRIX time_t tmp; tmp = time(0); elapsed = difftime (tmp, start);#endif stream << (int)(elapsed / 3600) << ":" << (int)(elapsed / 60) % 60 << ":" << (int)elapsed % 60;#else stream << "not implemented";#endif} // Print ()// eof timer.cc
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -