C Language: Get the boot time

Get boot time to use GetTickCount () This API , feature time at the beginning to get re-run system . code show as below:

 
  1. #include<stdio.h>
  2. #include<windows.h>
  3.  
  4. int main ()
  5. {
  6. DWORD k = GetTickCount();
  7. int s = k/1000;
  8. you min = 0, h = 0;
  9. if (s >= 60){
  10. min = p / 60;
  11. s = s % 60;
  12. }
  13. if (min >= 60){
  14. h = min / 60;
  15. min = min 60%;
  16. }
  17. printf ( "re-boot the system over time now:% dh% d min% ds \ n", h, min, s);
  18.  
  19. system("pause");
  20. return 0;
  21. }

operation result:

Now re-boot the system over time: 37 h 21 min 19 s
, press any key to continue.

 

 

Guess you like

Origin blog.csdn.net/weixin_44015669/article/details/92679124