aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/args.c7
-rw-r--r--src/notify.c12
2 files changed, 12 insertions, 7 deletions
diff --git a/src/args.c b/src/args.c
index 54eb52a..66584cf 100644
--- a/src/args.c
+++ b/src/args.c
@@ -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;