mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-06 02:55:49 +03:00
date: Add "-u" argument for printing current Unix timestamp.
This commit is contained in:
parent
5e938868a2
commit
3ae75e04ec
Notes:
sideshowbarker
2024-07-19 14:16:11 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/3ae75e04ece
@ -1,12 +1,16 @@
|
||||
#include <LibC/time.h>
|
||||
#include <LibC/stdio.h>
|
||||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
(void) argc;
|
||||
(void) argv;
|
||||
|
||||
time_t now = time(nullptr);
|
||||
|
||||
if (argc == 2 && !strcmp(argv[1], "-u")) {
|
||||
printf("%u\n", now);
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto* tm = localtime(&now);
|
||||
printf("%4u-%02u-%02u %02u:%02u:%02u\n",
|
||||
tm->tm_year + 1900,
|
||||
|
Loading…
Reference in New Issue
Block a user