// vim:ts=8:expandtab #include #include #include void print_time(const char *format) { static char part[512]; /* Get date & time */ time_t current_time = time(NULL); struct tm *current_tm = localtime(¤t_time); (void)strftime(part, sizeof(part), format, current_tm); printf("%s", part); }