poser
A C framework for POsix SERvices
Loading...
Searching...
No Matches
PSC_Timer Class Reference

A timer. More...

#include <poser/core/timer.h>

Public Member Functions

PSC_Timer * PSC_Timer_create (void)
 PSC_Timer default constructor.
 
PSC_Event * PSC_Timer_expired (PSC_Timer *self)
 The timer expired.
 
void PSC_Timer_setMs (PSC_Timer *self, unsigned ms)
 Set expiry in milliseconds.
 
void PSC_Timer_start (PSC_Timer *self, int periodic)
 Start the timer.
 
void PSC_Timer_stop (PSC_Timer *self)
 Stop the timer.
 
void PSC_Timer_destroy (PSC_Timer *self)
 PSC_Timer destructor.
 

Detailed Description

A timer.

Member Function Documentation

◆ PSC_Timer_create()

PSC_Timer * PSC_Timer_create ( void  )

PSC_Timer default constructor.

Creates a new PSC_Timer

Returns
a newly created PSC_Timer

◆ PSC_Timer_destroy()

void PSC_Timer_destroy ( PSC_Timer *  self)

PSC_Timer destructor.

Destroys the timer. If it is currently running, it is stopped first.

Parameters
selfthe PSC_Timer

◆ PSC_Timer_expired()

PSC_Event * PSC_Timer_expired ( PSC_Timer *  self)

The timer expired.

This event is fired on each expiry of the timer.

Parameters
selfthe PSC_Timer
Returns
the expired event

◆ PSC_Timer_setMs()

void PSC_Timer_setMs ( PSC_Timer *  self,
unsigned  ms 
)

Set expiry in milliseconds.

Sets the expiry time in milliseconds. If the timer is currently running, it is first stopped and then restarted with the new value. The initial value is 1000 milliseconds (1 second).

Parameters
selfthe PSC_Timer
msexpiry in milliseconds

◆ PSC_Timer_start()

void PSC_Timer_start ( PSC_Timer *  self,
int  periodic 
)

Start the timer.

Starts the timer. An expired event will be fired after the configured. If the timer is already running, stops and restarts it. expiry time.

Parameters
selfthe PSC_Timer
periodicif nonzero, expire periodically until explicitly stopped.

◆ PSC_Timer_stop()

void PSC_Timer_stop ( PSC_Timer *  self)

Stop the timer.

Stops the timer. No further expired events will occur until PSC_Timer_start() is called again.

Parameters
selfthe PSC_Timer

The documentation for this class was generated from the following file: