mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:17:44 +00:00
Userland: Pretty-print modification times in /bin/ls.
This commit is contained in:
parent
5751063c63
commit
10fde0d707
1 changed files with 9 additions and 1 deletions
|
@ -4,6 +4,7 @@
|
|||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <getopt.h>
|
||||
#include <time.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <AK/AKString.h>
|
||||
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue