Created
March 4, 2016 07:39
-
-
Save Hikari9/4aa73b6da2d67d21e353 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cstdio> | |
#include <ctime> | |
#ifdef __GNUC__ | |
#include <unistd.h> | |
#define SLEEP(t) sleep(t) | |
#else | |
#include <cstdlib> | |
#define SLEEP(t) _sleep(t*1000) | |
#endif | |
using namespace std; | |
char buffer[26]; | |
int main() { | |
for (int pdate = 1;; ++pdate) { | |
time_t now = time(NULL); | |
strftime(buffer, 26, "[%Y-%m-%d] %H:%M:%S", localtime(&now)); | |
printf("%s\n", buffer); | |
if (pdate % 3 == 0) | |
printf("\"This program has gone on for far too long. Type Ctrl+C to abort this silly application.\"\n"); | |
SLEEP(10); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment