first commit
This commit is contained in:
12
src/date_time_handling.c
Normal file
12
src/date_time_handling.c
Normal file
@ -0,0 +1,12 @@
|
||||
#include "date_time_handling.h"
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
|
||||
void get_date(char buffer[]) {
|
||||
// add 1 because strlen does not include the null character
|
||||
size_t buffer_size = strlen(buffer) + 1;
|
||||
time_t my_unix_ts = time(NULL);
|
||||
struct tm* my_tm_local = localtime(&my_unix_ts);
|
||||
strftime(buffer, buffer_size, "%Y%m%dT%H%M%S", my_tm_local);
|
||||
}
|
||||
|
Reference in New Issue
Block a user