From 0f781f8cb09530df37be64b0214f3c5d911aafe8 Mon Sep 17 00:00:00 2001 From: Frederic Culot Date: Wed, 4 Apr 2007 19:40:28 +0000 Subject: MAX_LENGTH replaced by stdio.h's BUFSIZ use of DAYINSEC and MININSEC defines --- src/notify.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/notify.c') diff --git a/src/notify.c b/src/notify.c index ef2e809..e6374f3 100755 --- a/src/notify.c +++ b/src/notify.c @@ -1,4 +1,4 @@ -/* $calcurse: notify.c,v 1.9 2007/03/24 23:17:09 culot Exp $ */ +/* $calcurse: notify.c,v 1.10 2007/04/04 19:41:57 culot Exp $ */ /* * Calcurse - text-based organizer @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -123,7 +124,7 @@ notify_update_bar(void) const int space = 3; int file_pos, date_pos, app_pos, txt_max_len, too_long = 0; int time_left, hours_left, minutes_left; - char buf[MAX_LENGTH]; + char buf[BUFSIZ]; date_pos = space; pthread_mutex_lock(¬ify->mutex); @@ -148,8 +149,9 @@ notify_update_bar(void) } time_left = notify_app->time - notify->time_in_sec; if (time_left > 0) { - hours_left = (time_left / 3600); - minutes_left = (time_left - hours_left*3600) / 60; + hours_left = (time_left / HOURINSEC); + minutes_left = (time_left - hours_left * DAYINSEC) / + MININSEC; pthread_mutex_lock(&nbar->mutex); if (time_left < nbar->cntdwn) wattron(notify->win, A_BLINK); @@ -202,11 +204,15 @@ notify_extract_aptsfile(void) static void * notify_main_thread(void *arg) { - unsigned thread_sleep = 1, check_app = 60; - int elapse = 0, got_app = 0; + const unsigned thread_sleep = 1; + const unsigned check_app = MININSEC; + int elapse= 0, got_app = 0; struct tm *ntime; time_t ntimer; + elapse = 0; + got_app = 0; + for (;;) { ntimer = time(NULL); ntime = localtime(&ntimer); -- cgit v1.2.3-54-g00ecf