blob: 8cae81d37690edf394edabcb9957fd8f58250930 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
/* SPDX-License-Identifier: BSD-3-Clause */
/*
* Copyright (C) 2022, 2023 Ferass El Hafidi <vitali64pmemail@protonmail.com>
* Copyright (C) 2022 Leah Rowe <leah@libreboot.org>
*/
#include <time.h>
#include <stdio.h>
#include <errno.h>
#define REQ_ERRPRINT
#include "../common/common.h"
int main(int argc, char *argv[]) {
time_t epoch = time(NULL);
struct tm* date = localtime(&epoch);
char date_s[31];
const char *format;
if (argc == 2 && argv[1][0] == '+') {
argv[1]++;
format = argv[1];
}
else {
format = "%a %b %e %H:%M:%S %Z %Y";
}
strftime(date_s, 31, format, date);
printf("%s\n", date_s);
return errprint(argv[0], NULL, errno);
}
|