diff options
author | Peter Collingbourne <pcc@google.com> | 2019-01-08 15:22:50 -0800 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2019-01-08 19:21:17 -0600 |
commit | 93e1b9ecb17481a15f4681d07125892c16eeb10b (patch) | |
tree | 6dedd2435fd1295f52cea33d6ec92f8b19030694 | |
parent | ae04b513b269db6300bce71eb303d23ab162b2da (diff) | |
download | toybox-93e1b9ecb17481a15f4681d07125892c16eeb10b.tar.gz |
ls: Fix -t to also sort by st_mtim.tv_nsec.
-rw-r--r-- | toys/posix/ls.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/toys/posix/ls.c b/toys/posix/ls.c index 976b3343..d24168d6 100644 --- a/toys/posix/ls.c +++ b/toys/posix/ls.c @@ -169,6 +169,8 @@ static int compare(void *a, void *b) if (toys.optflags & FLAG_t) { if (dta->st.st_mtime > dtb->st.st_mtime) ret = -1; else if (dta->st.st_mtime < dtb->st.st_mtime) ret = 1; + else if (dta->st.st_mtim.tv_nsec > dtb->st.st_mtim.tv_nsec) ret = -1; + else if (dta->st.st_mtim.tv_nsec < dtb->st.st_mtim.tv_nsec) ret = 1; } if (!ret) ret = strcmp(dta->name, dtb->name); return ret * reverse; |