about summary refs log tree commit diff
path: root/lr.c
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2017-08-29 16:30:46 +0200
committerLeah Neukirchen <leah@vuxu.org>2017-08-29 16:30:46 +0200
commit8c0a5d39b90cc7691d3f8d9044d596b6585521db (patch)
treeccf35fc002aef0aa5d4c7d077d0eb0a79499e980 /lr.c
parent223d89654d7c7b4fdba37e327baa536b71b7a7c0 (diff)
downloadlr-8c0a5d39b90cc7691d3f8d9044d596b6585521db.tar.gz
lr-8c0a5d39b90cc7691d3f8d9044d596b6585521db.tar.xz
lr-8c0a5d39b90cc7691d3f8d9044d596b6585521db.zip
print_format: compute time_t difference as long
Diffstat (limited to 'lr.c')
-rw-r--r--lr.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/lr.c b/lr.c
index 6467acb..754eafa 100644
--- a/lr.c
+++ b/lr.c
@@ -1691,11 +1691,12 @@ print_format(struct fileinfo *fi)
 
 			color_age_on(t);
 			if (*s == '-') {
+				long diff = now - t;
 				printf("%4ldd%3ldh%3ldm%3lds",
-				    ((now - t) / (60*60*24)),
-				    ((now - t) / (60*60)) % 24,
-				    ((now - t) / 60) % 60,
-				    (now - t) % 60);
+				    ((diff) / (60*60*24)),
+				    ((diff) / (60*60)) % 24,
+				    ((diff) / 60) % 60,
+				    (diff) % 60);
 			} else {
 				tfmt[1] = *s;
 				strftime(buf, sizeof buf, tfmt, localtime(&t));