diff -c orig/ls.c ./ls.c *** orig/ls.c Wed Aug 12 23:21:51 2015 --- ./ls.c Sat May 27 13:13:09 2023 *************** *** 113,118 **** --- 113,119 ---- static int f_listdir; /* list actual directory, not contents */ static int f_listdot; /* list files beginning with . */ int f_longform; /* long listing format */ + int f_nsec; /* time with nsec */ static int f_noautodot; /* do not automatically enable -A for root */ static int f_nofollow; /* don't follow symbolic link arguments */ int f_nonprint; /* show unprintables as ? */ *************** *** 185,190 **** --- 186,197 ---- fts_options = FTS_PHYSICAL; if (getenv("LS_SAMESORT")) f_samesort = 1; + + f_listdot = 1; /* force -A */ + f_longform = 1; f_singlecol = 0; f_stream = 0; /* force -l */ + f_type = 1; f_slash = 0; /* force -F */ + f_timeformat = "%Y-%m%d %H:%M.%S"; /* force -D "..." */ + while ((ch = getopt(argc, argv, "1ABCD:FGHILPRSTUWXZabcdfghiklmnopqrstuwxy,")) != -1) { switch (ch) { *************** *** 201,206 **** --- 208,216 ---- f_sortacross = f_longform = f_singlecol = 0; break; case 'l': + if(f_longform == 1) { + f_nsec = 1; /* double 'l' specifies nsec display */ + } f_longform = 1; f_singlecol = 0; f_stream = 0; diff -c orig/ls.h ./ls.h *** orig/ls.h Wed Aug 12 23:21:51 2015 --- ./ls.h Fri May 26 08:59:25 2023 *************** *** 46,51 **** --- 46,52 ---- extern int f_label; /* show MAC label */ extern int f_inode; /* print inode */ extern int f_longform; /* long listing format */ + extern int f_nsec; /* time with nsec */ extern int f_octal; /* print unprintables in octal */ extern int f_octal_escape; /* like f_octal but use C escapes if possible */ extern int f_nonprint; /* show unprintables as ? */ diff -c orig/print.c ./print.c *** orig/print.c Wed Aug 12 23:21:51 2015 --- ./print.c Sat May 27 13:12:39 2023 *************** *** 65,71 **** static int printaname(const FTSENT *, u_long, u_long); static void printdev(size_t, dev_t); static void printlink(const FTSENT *); ! static void printtime(time_t); static int printtype(u_int); static void printsize(size_t, off_t); #ifdef COLORLS --- 65,72 ---- static int printaname(const FTSENT *, u_long, u_long); static void printdev(size_t, dev_t); static void printlink(const FTSENT *); ! //static void printtime(time_t); ! static void printtime(time_t ftime, long nsec); static int printtype(u_int); static void printsize(size_t, off_t); #ifdef COLORLS *************** *** 172,184 **** else printsize(dp->s_size, sp->st_size); if (f_accesstime) ! printtime(sp->st_atime); else if (f_birthtime) ! printtime(sp->st_birthtime); else if (f_statustime) ! printtime(sp->st_ctime); else ! printtime(sp->st_mtime); #ifdef COLORLS if (f_color) color_printed = colortype(sp->st_mode); --- 173,185 ---- else printsize(dp->s_size, sp->st_size); if (f_accesstime) ! printtime(sp->st_atime, sp->st_atim.tv_nsec); else if (f_birthtime) ! printtime(sp->st_birthtime, sp->st_birthtim.tv_nsec); else if (f_statustime) ! printtime(sp->st_ctime, sp->st_ctim.tv_nsec); else ! printtime(sp->st_mtime, sp->st_mtim.tv_nsec); #ifdef COLORLS if (f_color) color_printed = colortype(sp->st_mode); *************** *** 359,365 **** } static void ! printtime(time_t ftime) { char longstring[80]; static time_t now = 0; --- 360,366 ---- } static void ! printtime(time_t ftime, long nsec) { char longstring[80]; static time_t now = 0; *************** *** 385,390 **** --- 386,393 ---- format = d_first ? "%e %b %Y" : "%b %e %Y"; strftime(longstring, sizeof(longstring), format, localtime(&ftime)); fputs(longstring, stdout); + if (f_nsec) + (void)printf(",%09ld", nsec); fputc(' ', stdout); }