aboutsummaryrefslogtreecommitdiff
path: root/analyzer/utils/time.c
blob: 740b8e912052616b32d25572aaa8a16f72ec4cfe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "utils/time.h"

#include <stdio.h>
#include <time.h>

void get_date_time_string(char *date_time) {
    time_t now = time(NULL);
    struct tm *t = localtime(&now);
    sprintf(
        date_time,
        "%02d%02d%02d_%02d%02d%02d",
        t->tm_year - 100,
        t->tm_mon + 1,
        t->tm_mday,
        t->tm_hour,
        t->tm_min,
        t->tm_sec
    );
}