| 
    lwpa
    0.1.0
    
   LightWeight Platform Abstraction (lwpa) 
   | 
  
  
     
      View other versions:
      
     
   | 
  
 
Platform-neutral system timers.
#include "lwpa_timer.h"
Data Structures | |
| struct | LwpaTimer | 
| A millisecond-resolution timer.  More... | |
Macros | |
| #define | lwpa_timer_start(lwpatimerptr, intval) | 
| Start a timer.  More... | |
| #define | lwpa_timer_reset(lwpatimerptr) (((lwpatimerptr)->reset_time) = lwpa_getms()) | 
| Reset a timer while keeping the same interval.  More... | |
| #define | lwpa_timer_elapsed(lwpatimerptr) (lwpa_getms() - (lwpatimerptr)->reset_time) | 
| Get the time since a timer was reset.  More... | |
| #define | lwpa_timer_isexpired(lwpatimerptr) (((lwpatimerptr)->interval == 0) || (lwpa_timer_elapsed(lwpatimerptr) > (lwpatimerptr)->interval)) | 
| Check to see if a timer is expired.  More... | |
Typedefs | |
| typedef struct LwpaTimer | LwpaTimer | 
| A millisecond-resolution timer.  More... | |
Functions | |
| uint32_t | lwpa_getms () | 
| Get a monotonically-increasing millisecond value.  More... | |
| uint32_t | lwpa_timer_remaining (const LwpaTimer *timer) | 
| Get the amount of time remaining in a timer.  More... | |
| #define lwpa_timer_elapsed | ( | lwpatimerptr | ) | (lwpa_getms() - (lwpatimerptr)->reset_time) | 
Get the time since a timer was reset.
| lwpatimerptr | Pointer to the LwpaTimer of which to get the elapsed time. | 
| #define lwpa_timer_isexpired | ( | lwpatimerptr | ) | (((lwpatimerptr)->interval == 0) || (lwpa_timer_elapsed(lwpatimerptr) > (lwpatimerptr)->interval)) | 
Check to see if a timer is expired.
| lwpatimerptr | Pointer to the LwpaTimer of which to check the expiration. | 
| #define lwpa_timer_reset | ( | lwpatimerptr | ) | (((lwpatimerptr)->reset_time) = lwpa_getms()) | 
Reset a timer while keeping the same interval.
| lwpatimerptr | Pointer to the LwpaTimer to reset. | 
| #define lwpa_timer_start | ( | lwpatimerptr, | |
| intval | |||
| ) | 
Start a timer.
| lwpatimerptr | Pointer to the LwpaTimer to start. | 
| intval | Timer interval in milliseconds. An interval of 0 will result in a timer that is always expired. | 
A millisecond-resolution timer.
The times are represented in milliseconds by a 32-bit unsigned integer. Since the timer is monotonically-increasing, wraparound is handled by doing comparisons of the form
rather than
.
| uint32_t lwpa_getms | ( | ) | 
Get a monotonically-increasing millisecond value.