diff options
author | Arun Prakash Jana <engineerarun@gmail.com> | 2019-07-11 22:33:49 +0530 |
---|---|---|
committer | Arun Prakash Jana <engineerarun@gmail.com> | 2019-07-11 22:33:49 +0530 |
commit | 406faf63d953a582f0241398c05ef55333fb034a (patch) | |
tree | 73b3c22b23c43d4158992d3170fccaffcd48d8cf /src | |
parent | 201b1ae5710ea8c8ae7f68594e4c006932203283 (diff) | |
download | nnn-406faf63d953a582f0241398c05ef55333fb034a.tar.gz |
Fix mtime comparison
Diffstat (limited to 'src')
-rw-r--r-- | src/nnn.c | 17 |
1 files changed, 6 insertions, 11 deletions
@@ -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; } |