我尝试了Windows API函数,但我不明白哪一个符合我的要求。与GetTickCount64
,QueryInterruptTime
等相同。如何计算?
答案 0 :(得分:0)
GetTickCount64
返回自上次启动以来的毫秒数。这应该足够了。
答案 1 :(得分:-2)
您也可以使用GetTickCount()
。像这样:
#include <Windows.h>
#include <stdio.h>
int main(){
int hours;
int min;
int sec;
int rem1;
int nSysUpTime = GetTickCount() / 1000;
int days = nSysUpTime / 60 / 60 / 24;
hours = nSysUpTime / 3600;
rem1 = nSysUpTime % 3600;
min = rem1 / 60;
sec = rem1 % 60;
printf( "\nComputer Uptime %02d:%02d:%02d \n\n",hours , min ,sec );
return 0;
}