# include # include # include # include # include "weekday.h" int main ( ); void timestamp ( ); /******************************************************************************/ int main ( ) /******************************************************************************/ /* Purpose: weekday_test() tests weekday(). Licensing: This code is distributed under the MIT license. Modified: 26 May 2012 Author: John Burkardt */ { timestamp ( ); printf ( "\n" ); printf ( "weekday_test():\n" ); printf ( " C version\n" ); printf ( " Test weekday().\n" ); jed_to_weekday_test ( ); ymd_to_weekday_common_test ( ); /* Terminate. */ printf ( "\n" ); printf ( "weekday_test():\n" ); printf ( " Normal end of execution.\n" ); printf ( "\n" ); timestamp ( ); return 0; } /******************************************************************************/ void timestamp ( ) /******************************************************************************/ /* 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: 24 September 2003 Author: John Burkardt */ { # define TIME_SIZE 40 static char time_buffer[TIME_SIZE]; const struct tm *tm; time_t now; now = time ( NULL ); tm = localtime ( &now ); strftime ( time_buffer, TIME_SIZE, "%d %B %Y %I:%M:%S %p", tm ); fprintf ( stdout, "%s\n", time_buffer ); return; # undef TIME_SIZE }