diff options
Diffstat (limited to 'cpukit/posix/src/ualarm.c')
-rw-r--r-- | cpukit/posix/src/ualarm.c | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/cpukit/posix/src/ualarm.c b/cpukit/posix/src/ualarm.c index 6fcc4087ed..8910dac217 100644 --- a/cpukit/posix/src/ualarm.c +++ b/cpukit/posix/src/ualarm.c @@ -66,27 +66,23 @@ useconds_t ualarm( if ( !the_timer->routine ) { _Watchdog_Initialize( the_timer, _POSIX_signals_Ualarm_TSR, 0, NULL ); } else { - switch ( _Watchdog_Remove( the_timer ) ) { - case WATCHDOG_INACTIVE: - case WATCHDOG_BEING_INSERTED: - break; - - case WATCHDOG_ACTIVE: - case WATCHDOG_REMOVE_IT: - /* - * The stop_time and start_time fields are snapshots of ticks since - * boot. Since alarm() is dealing in seconds, we must account for - * this. - */ - - ticks = the_timer->initial; - ticks -= (the_timer->stop_time - the_timer->start_time); - /* remaining is now in ticks */ - - _Timespec_From_ticks( ticks, &tp ); - remaining = tp.tv_sec * TOD_MICROSECONDS_PER_SECOND; - remaining += tp.tv_nsec / 1000; - break; + Watchdog_States state; + + state = _Watchdog_Remove( the_timer ); + if ( (state == WATCHDOG_ACTIVE) || (state == WATCHDOG_REMOVE_IT) ) { + /* + * The stop_time and start_time fields are snapshots of ticks since + * boot. Since alarm() is dealing in seconds, we must account for + * this. + */ + + ticks = the_timer->initial; + ticks -= (the_timer->stop_time - the_timer->start_time); + /* remaining is now in ticks */ + + _Timespec_From_ticks( ticks, &tp ); + remaining = tp.tv_sec * TOD_MICROSECONDS_PER_SECOND; + remaining += tp.tv_nsec / 1000; } } |