返回列表 发帖
#include "stdafx.h"
#include "time.h"
#include "stdio.h"
#include "windows.h"

int main(int argc, char* argv[])
{
        UINT64 i = 0;
       FILE *pFile;
      pFile=fopen("result.txt", "w+");

        time_t tm = time(NULL);
        while (time(NULL)-tm == 0);        //保证计时从一秒的开头算起

        tm = time(NULL);
        while (time(NULL)-tm < 10) i++;        //10秒钟
        
        printf("%u", i/100000000);
        printf("%u\n", i%100000000);
        fprintf("%u", i/100000000);
        fprintf("%u\n", i%100000000);
        fclose(pFile);
        return 0;
}
修改下,大家用起来也许更方便,把result.txt打开,就看到结果了

TOP

返回列表