| 1146 | /******************************************************************************/ |
| 1147 | |
| 1148 | void timestamp ( void ) |
| 1149 | |
| 1150 | /******************************************************************************/ |
| 1151 | /* |
| 1152 | Purpose: |
| 1153 | |
| 1154 | TIMESTAMP prints the current YMDHMS date as a time stamp. |
| 1155 | |
| 1156 | Example: |
| 1157 | |
| 1158 | 31 May 2001 09:45:54 AM |
| 1159 | |
| 1160 | Licensing: |
| 1161 | |
| 1162 | This code is distributed under the GNU LGPL license. |
| 1163 | |
| 1164 | Modified: |
| 1165 | |
| 1166 | 24 September 2003 |
| 1167 | |
| 1168 | Author: |
| 1169 | |
| 1170 | John Burkardt |
| 1171 | |
| 1172 | Parameters: |
| 1173 | |
| 1174 | None |
| 1175 | */ |
| 1176 | { |
| 1177 | # define TIME_SIZE 40 |
| 1178 | |
| 1179 | static char time_buffer[TIME_SIZE]; |
| 1180 | const struct tm *tm; |
| 1181 | size_t len; |
| 1182 | time_t now; |
| 1183 | |
| 1184 | now = time ( NULL ); |
| 1185 | tm = localtime ( &now ); |
| 1186 | |
| 1187 | len = strftime ( time_buffer, TIME_SIZE, "%d %B %Y %I:%M:%S %p", tm ); |
| 1188 | |
| 1189 | printf ( "%s\n", time_buffer ); |
| 1190 | |
| 1191 | return; |
| 1192 | # undef TIME_SIZE |
| 1193 | } |
| 1194 | |