From 10fde0d70730d63d00a57c1ec16998c8ba0522db Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 3 Feb 2019 02:14:41 +0100 Subject: [PATCH] Userland: Pretty-print modification times in /bin/ls. --- Userland/ls.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Userland/ls.cpp b/Userland/ls.cpp index a431cf8af5..2ce036152f 100644 --- a/Userland/ls.cpp +++ b/Userland/ls.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -162,7 +163,14 @@ int do_dir(const char* path) else printf(" %10u ", st.st_size); - printf(" %10u ", st.st_mtime); + auto* tm = localtime(&st.st_mtime); + printf(" %4u-%02u-%02u %02u:%02u:%02u ", + tm->tm_year + 1900, + tm->tm_mon + 1, + tm->tm_mday, + tm->tm_hour, + tm->tm_min, + tm->tm_sec); print_name(st, de->d_name, pathbuf);