From e2f27aa7b5444d732b4aa442d9948b7bd4d3b339 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 3 Feb 2019 02:47:37 +0100 Subject: [PATCH] Userland: Make /bin/date pretty-print the date, too. --- Userland/date.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Userland/date.cpp b/Userland/date.cpp index 2610f60ca6..951cfb21cc 100644 --- a/Userland/date.cpp +++ b/Userland/date.cpp @@ -5,8 +5,16 @@ int main(int argc, char** argv) { (void) argc; (void) argv; + time_t now = time(nullptr); - printf("%u\n", now); + auto* tm = localtime(&now); + printf("%4u-%02u-%02u %02u:%02u:%02u\n", + tm->tm_year + 1900, + tm->tm_mon + 1, + tm->tm_mday, + tm->tm_hour, + tm->tm_min, + tm->tm_sec); return 0; }