X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Ftimer.c;fp=src%2Ftimer.c;h=fe42c75fd9e76f224b7512da65b5c11f79108bc6;hb=f293aee603c7b4abfb88e3bf8ba44cad54cc2e91;hp=a17e21f5be6d84df6a5a93bda83c20b2e6d7de02;hpb=24378226940341b1a14ef3039042f8d643f570ec;p=stopish diff --git a/src/timer.c b/src/timer.c index a17e21f..fe42c75 100644 --- a/src/timer.c +++ b/src/timer.c @@ -60,13 +60,26 @@ char *stopish_get_time_string( void ) h = m = s = ss = 0; } + if ( stopish_get_type( ) == STOPISH_TYPE_COUNTDOWN ) { + h = -h; + m = -m; + s = -s; + ss = -ss; + } + // countdown check + if ( stopish_get_type( ) == STOPISH_TYPE_COUNTDOWN && + ( h == 0 && m == 0 && s == 0 && ss == 0 ) ) + return NULL; + timeBuffer = malloc( 64 ); if ( timerPrecision == TIMER_PRECISION_MINUTE ) sprintf( timeBuffer, "%.02d:%.02d.%.1d", - m, s, ss ); + ( unsigned int ) m, ( unsigned int ) s, + ( unsigned int ) ss ); else sprintf( timeBuffer, "%.02d:%.02d:%.02d.%.1d", - h, m, s, ss ); + ( unsigned int ) h, ( unsigned int ) m, + ( unsigned int ) s, ( unsigned int ) ss ); return timeBuffer; }