aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-07-11 22:33:49 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-07-11 22:33:49 +0530
commit406faf63d953a582f0241398c05ef55333fb034a (patch)
tree73b3c22b23c43d4158992d3170fccaffcd48d8cf /src
parent201b1ae5710ea8c8ae7f68594e4c006932203283 (diff)
downloadnnn-406faf63d953a582f0241398c05ef55333fb034a.tar.gz
Fix mtime comparison
Diffstat (limited to 'src')
-rw-r--r--src/nnn.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/nnn.c b/src/nnn.c
index 6fa3d9c..dbd54f2 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -1486,28 +1486,23 @@ static int entrycmp(const void *va, const void *vb)
if ((pb->flags & DIR_OR_LINK_TO_DIR) != (pa->flags & DIR_OR_LINK_TO_DIR)) {
if (pb->flags & DIR_OR_LINK_TO_DIR)
return 1;
-
return -1;
}
- /* Do the actual sorting */
+ /* Sort based on specified order */
if (cfg.mtimeorder) {
- if (pb->t >= pa->t)
- return (int)(pb->t - pa->t);
-
- return -1;
- }
-
- if (cfg.sizeorder) {
+ if (pb->t > pa->t)
+ return 1;
+ if (pb->t < pa->t)
+ return -1;
+ } else if (cfg.sizeorder) {
if (pb->size > pa->size)
return 1;
-
if (pb->size < pa->size)
return -1;
} else if (cfg.blkorder) {
if (pb->blocks > pa->blocks)
return 1;
-
if (pb->blocks < pa->blocks)
return -1;
}