Offers a timer which signals timeout via input ready state of sys_iochannel_t. This allows you to handle timers like any other io-device.
You need to include “C-kern/api/time/timevalue.h” before you can use the interface.
SysTimer | Offers a timer which signals timeout via input ready state of sys_iochannel_t. |
Copyright | This program is free software. |
Files | |
C-kern/ | Header file SysTimer. |
C-kern/ | Linux implementation file SysTimer Linux. |
Types | |
systimer_t | Exports systimer_t as alias for sys_iochannel_t. |
Functions | |
test | |
unittest_time_systimer | Unittest for systimer_t. |
systimer_t | Implements system timer to measure periods of time. |
lifetime | |
systimer_FREE | Static initializer. |
init_systimer | Allocates a new system timer. |
free_systimer | Frees any resources associated with the timer. |
measure | |
start_systimer | This function starts (arms) a one shot timer. |
startinterval_systimer | This function starts (arms) a periodic timer. |
stop_systimer | Stops a timer. |
wait | |
wait_systimer | Waits until timer expires. |
query | |
remainingtime_systimer | Returns the remaining time until the timer expires the next time. |
expirationcount_systimer | Returns the number of times the timer has expired. |
This program is free software. You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
© 2011 Jörg Seebohn
Header file SysTimer.
Linux implementation file SysTimer Linux.
typedef sys_iochannel_t systimer_t
Exports systimer_t as alias for sys_iochannel_t.
test | |
unittest_time_systimer | Unittest for systimer_t. |
int unittest_time_systimer( void )
Unittest for systimer_t.
typedef sys_iochannel_t systimer_t
Implements system timer to measure periods of time.
lifetime | |
systimer_FREE | Static initializer. |
init_systimer | Allocates a new system timer. |
free_systimer | Frees any resources associated with the timer. |
measure | |
start_systimer | This function starts (arms) a one shot timer. |
startinterval_systimer | This function starts (arms) a periodic timer. |
stop_systimer | Stops a timer. |
wait | |
wait_systimer | Waits until timer expires. |
query | |
remainingtime_systimer | Returns the remaining time until the timer expires the next time. |
expirationcount_systimer | Returns the number of times the timer has expired. |
int init_systimer( /*out*/systimer_t * timer, sysclock_e clock_type )
Allocates a new system timer. See sysclock_e for the different clocks the timer can use to measure time.
int startinterval_systimer( systimer_t timer, struct timevalue_t * interval_time )
This function starts (arms) a periodic timer. The started timer fires (expires) at regular intervals after interval_time seconds (+nanoseconds). After the timer has expired it is restarted with interval_time.
int wait_systimer( systimer_t timer )
Waits until timer expires. It returns EINVAL if a stopped timer is waited for. After a successfull call to this function calling expirationcount_systimer will return a value != 0. If the timer has already expired (expirationcount_systimer return != 0) calling this function has no effect. It will return immediately.
The timer is also a file descriptor. If the timer expires this is signaled as file descriptor being readable.
Choose Posix file descriptor type.
#define sys_iochannel_t int
Exports systimer_t as alias for sys_iochannel_t.
typedef sys_iochannel_t systimer_t
Unittest for systimer_t.
int unittest_time_systimer( void )
Static initializer.
#define systimer_FREE sys_iochannel_FREE
Allocates a new system timer.
int init_systimer( /*out*/systimer_t * timer, sysclock_e clock_type )
Frees any resources associated with the timer.
int free_systimer( systimer_t * timer )
This function starts (arms) a one shot timer.
int start_systimer( systimer_t timer, struct timevalue_t * relative_time )
This function starts (arms) a periodic timer.
int startinterval_systimer( systimer_t timer, struct timevalue_t * interval_time )
Stops a timer.
int stop_systimer( systimer_t timer )
Waits until timer expires.
int wait_systimer( systimer_t timer )
Returns the remaining time until the timer expires the next time.
int remainingtime_systimer( systimer_t timer, struct timevalue_t * remaining_time )
Returns the number of times the timer has expired.
int expirationcount_systimer( systimer_t timer, /*out*/uint64_t * expiration_count )