summaryrefslogtreecommitdiff
path: root/src/print_time.c
blob: 68714372bd1acc2bf5c05350dd52052c0d81a798 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// vim:ts=8:expandtab
#include <time.h>
#include <stdio.h>
#include <stdlib.h>

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