# include # include # include # include # include using namespace std; # include "weekday.hpp" int main ( ); void timestamp ( ); //****************************************************************************80 int main ( ) //****************************************************************************80 // // Purpose: // // weekday_test() tests weekday(). // // Licensing: // // This code is distributed under the MIT license. // // Modified: // // 04 July 2017 // // Author: // // John Burkardt // { timestamp ( ); cout << "\n"; cout << "weekday_test():\n"; cout << " C++ version\n"; cout << " Test weekday().\n"; jed_to_weekday_test ( ); ymd_to_weekday_common_test ( ); // // Terminate. // cout << "\n"; cout << "weekday_test():\n"; cout << " Noraml end of execution.\n"; cout << "\n"; timestamp ( ); return 0; } //****************************************************************************80 void timestamp ( ) //****************************************************************************80 // // Purpose: // // TIMESTAMP prints the current YMDHMS date as a time stamp. // // Example: // // 31 May 2001 09:45:54 AM // // Licensing: // // This code is distributed under the MIT license. // // Modified: // // 08 July 2009 // // Author: // // John Burkardt // { # define TIME_SIZE 40 static char time_buffer[TIME_SIZE]; const struct std::tm *tm_ptr; std::time_t now; now = std::time ( NULL ); tm_ptr = std::localtime ( &now ); std::strftime ( time_buffer, TIME_SIZE, "%d %B %Y %I:%M:%S %p", tm_ptr ); std::cout << time_buffer << "\n"; return; # undef TIME_SIZE }