diff options
author | Leah Neukirchen <leah@vuxu.org> | 2017-08-29 16:30:46 +0200 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2017-08-29 16:30:46 +0200 |
commit | 8c0a5d39b90cc7691d3f8d9044d596b6585521db (patch) | |
tree | ccf35fc002aef0aa5d4c7d077d0eb0a79499e980 | |
parent | 223d89654d7c7b4fdba37e327baa536b71b7a7c0 (diff) | |
download | lr-8c0a5d39b90cc7691d3f8d9044d596b6585521db.tar.gz lr-8c0a5d39b90cc7691d3f8d9044d596b6585521db.tar.xz lr-8c0a5d39b90cc7691d3f8d9044d596b6585521db.zip |
print_format: compute time_t difference as long
-rw-r--r-- | lr.c | 9 |
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)); |