Get boot time to use GetTickCount () This API , feature time at the beginning to get re-run system . code show as below:
- #include<stdio.h>
- #include<windows.h>
- int main ()
- {
- DWORD k = GetTickCount();
- int s = k/1000;
- you min = 0, h = 0;
- if (s >= 60){
- min = p / 60;
- s = s % 60;
- }
- if (min >= 60){
- h = min / 60;
- min = min 60%;
- }
- printf ( "re-boot the system over time now:% dh% d min% ds \ n", h, min, s);
- system("pause");
- return 0;
- }
operation result:
Now re-boot the system over time: 37 h 21 min 19 s
, press any key to continue.