下载后可任意编辑C 语言中如何猎取时间
1 使用 time_t time( time_t * timer ) 精确到秒2 使用 clock_t clock() 得到的是 CPU 时间精确到 1/CLOCKS_PER_SEC 秒3 计算时间差使用 double difftime( time_t timer1, time_t timer0 )4 使用 DWORD GetTickCount() 精确到毫秒5 假如使用 MFC 的 CTime 类,可以用 CTime::GetCurrentTime() 精确到秒6 要猎取高精度时间,可以使用BOOL QueryPerformanceFrequency(LARGE_INTEGER *lpFrequency)猎取系统的计数器的频率BOOL QueryPerformanceCounter(LARGE_INTEGER *lpPerformanceCount)猎取计数器的值然后用两次计数器的差除以 Frequency 就得到时间
7 Multimedia Timer FunctionsThe following functions are used with multimedia timers
timeBeginPeriod/timeEndPeriod/timeGetDevCaps/timeGetSystemTime//*********************************************************************//用标准 C 实现猎取当前系统时间的函数一
time()函数time(&rawtime)函数猎取当前时间距 1970 年 1 月 1 日的秒数,以秒计数单位,存于 rawtime 中
#include "time
h"void main (){time_t rawtime;str