// Playtime.cpp (c) Kari Laitinen // http://www.naturalprogramming.com/ // 1998-??-?? File created. // 2013-11-14 Last modification. /* WARNING: This file cannot be compiled with all C++ compilers as it uses the non-standard conio.h library. More info: http://en.wikipedia.org/wiki/Conio.h This did compile with the MinGW C++ compiler. */ #include #include // C-style time/date utilites using namespace std ; #include int main() { time_t previous_time, current_time ; long loop_counter = 0 ; cout << "\n loop_counter current_time asctime \n\n" ; time( &previous_time ) ; while ( ! kbhit() ) { loop_counter ++ ; time( ¤t_time ) ; if ( ( current_time > previous_time ) && ( ( current_time % 5 ) == 0 ) ) { cout << " " << loop_counter << " " << current_time << " " << asctime( localtime( ¤t_time ) ) ; previous_time = current_time ; loop_counter = 0 ; } } }