Skip to content

Instantly share code, notes, and snippets.

@Hikari9
Created March 4, 2016 07:39
Show Gist options
  • Save Hikari9/4aa73b6da2d67d21e353 to your computer and use it in GitHub Desktop.
Save Hikari9/4aa73b6da2d67d21e353 to your computer and use it in GitHub Desktop.
#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