diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lass.c | 11 |
1 files changed, 4 insertions, 7 deletions
@@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 /* - * lass.c - list files and directories in kernel style + * lass.c - list files and directories in Kebab style */ #include <stdio.h> @@ -29,8 +29,7 @@ static void print_file_info(const char *path, const char *name, int width_uid, struct passwd *pw; struct group *gr; struct tm *timeinfo; - time_t rawtime; - char time_buffer[20]; + char time_buffer[64]; if (stat(path, &st)) return; @@ -59,11 +58,9 @@ static void print_file_info(const char *path, const char *name, int width_uid, printf(" %*s %*s ", width_uid, pw ? pw->pw_name : "?", width_gid, gr ? gr->gr_name : "?"); - time(&rawtime); - timeinfo = localtime(&rawtime); - + timeinfo = localtime(&st.st_mtime); strftime(time_buffer, sizeof(time_buffer), - "%a %b %d %H:%M:%S %Y", timeinfo); + "%a %b %d %H:%M:%S %Y", timeinfo); printf("%s ", time_buffer); |