diff options
-rw-r--r-- | src/args.c | 7 | ||||
-rw-r--r-- | src/notify.c | 12 |
2 files changed, 12 insertions, 7 deletions
@@ -236,8 +236,11 @@ static void next_arg(void) if (next_app.got_app) { time_left = next_app.time - current_time; - hours_left = (time_left / HOURINSEC); - min_left = (time_left - hours_left * HOURINSEC) / MININSEC; + /* In minutes rounded up. */ + min_left = time_left / MININSEC + + (time_left % MININSEC ? 1 : 0); + hours_left = min_left / HOURINMIN; + min_left = min_left % HOURINMIN; fputs(_("next appointment:\n"), stdout); fprintf(stdout, " [%02d:%02d] %s\n", hours_left, min_left, next_app.txt); diff --git a/src/notify.c b/src/notify.c index d7dc610..334468b 100644 --- a/src/notify.c +++ b/src/notify.c @@ -279,12 +279,14 @@ void notify_update_bar(void) if (time_left > 0) { int hours_left, minutes_left; - hours_left = (time_left / HOURINSEC); - minutes_left = - (time_left - - hours_left * HOURINSEC) / MININSEC; - pthread_mutex_lock(&nbar.mutex); + /* In minutes rounded up. */ + minutes_left = time_left / MININSEC + + (time_left % MININSEC ? 1 : 0); + + hours_left = minutes_left / HOURINMIN; + minutes_left = minutes_left % HOURINMIN; + pthread_mutex_lock(&nbar.mutex); blinking = time_left <= nbar.cntdwn && notify_trigger(); WINS_NBAR_LOCK; |