snore

sleep with feedback
git clone git://git.bitsmanent.org/snore
Log | Files | Refs | README | LICENSE

commit 3ceed6c56a0ca2e6fd64cb4d35105419c1aa225e
parent 873b637fb00d474eb10e93ce46b8dfe04be6cdc6
Author: Claudio Alessi <smoppy@gmail.com>
Date:   Sat, 11 Jun 2022 20:39:50 +0200

Fix round issue in time_print()

Diffstat:
Msnore.c | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/snore.c b/snore.c @@ -92,8 +92,10 @@ time_print(double tm) { for(i = LENGTH(symbols) - 1; i >= 0; --i) { piece = tm / symbols[i].mult; + if(!symbols[i].precision) + piece = (int)piece; printf("%.*f%c%s", symbols[i].precision, piece, symbols[i].sym, i ? " " : ""); - tm -= (int)piece * symbols[i].mult; + tm -= piece * symbols[i].mult; } }