Advertisement
Guest User

odliczanko

a guest
Mar 18th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #include <iostream>
  2. #include <time.h>
  3. #include <stdio.h>
  4. #include <windows.h>
  5.  
  6. time_t unix = 1521417600; // unix time
  7. time_t timenow;
  8. int total, days, hours, minutes, seconds;
  9. std::string sd = "", sh = "", sm = "", ss = "";
  10.  
  11. int main()
  12. {
  13. while (true) {
  14. time(&timenow);
  15. total = unix - timenow; //difference
  16.  
  17. days = total / 60 / 60 / 24;
  18. hours = ((total / 60 / 60) % 24)-1;
  19. minutes = (total / 60) % 60;
  20. seconds = total % 60;
  21.  
  22. std::cout << days << "d " << hours << "h " << minutes << "min " << seconds << "s";
  23. Sleep(1000);
  24. system("cls");
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement