Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <time.h>
- #include <stdio.h>
- #include <windows.h>
- time_t unix = 1521417600; // unix time
- time_t timenow;
- int total, days, hours, minutes, seconds;
- std::string sd = "", sh = "", sm = "", ss = "";
- int main()
- {
- while (true) {
- time(&timenow);
- total = unix - timenow; //difference
- days = total / 60 / 60 / 24;
- hours = ((total / 60 / 60) % 24)-1;
- minutes = (total / 60) % 60;
- seconds = total % 60;
- std::cout << days << "d " << hours << "h " << minutes << "min " << seconds << "s";
- Sleep(1000);
- system("cls");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement