intervaltimer Class Reference

## Public Member Functions

| intervaltimer (int32_t which)
| ~intervaltimer ()
void | initialize ()
void | setInitialInterval (int32_t seconds, int32_t microseconds)
void | setPeriodicInterval (int32_t seconds, int32_t microseconds)
void | setIntervals (int32_t seconds, int32_t microseconds)
void | getInitialInterval (int32_t *seconds, int32_t *microseconds) const
void | getPeriodicInterval (int32_t *seconds, int32_t *microseconds) const
bool | start () const
bool | start (int32_t *seconds, int32_t *microseconds) const
bool | getTimeRemaining (int32_t *seconds, int32_t *microseconds) const
bool | stop ()

## Detailed Description

The intervaltimer class provides methods for interfacing with timers.

A timer has an initial interval and periodic intervals. The timer will raise a signal after the initial interval and then again after each periodic interval.

## Constructor & Destructor Documentation

intervaltimer::intervaltimer | ( | int32_t | which | ) |

Creates an instance of the intervaltimer class.

"which" must be one of: ITIMER_REAL - decrements in real time, raises SIGALRM ITIMER_VIRTUAL - decrements when the process is executing but not during system calls, raises SIGVTALRM ITIMER_PROF - decrements when the process is executing or and during system calls, raises SIGPROF

intervaltimer::~intervaltimer | ( |  | ) |

Deletes this instance of the intervaltimer class.

## Member Function Documentation

void intervaltimer::getInitialInterval | ( | int32_t * | seconds,
|  | int32_t * | microseconds
| ) |  | const

Sets "seconds" and "microseconds" to the timer's initial interval values.

void intervaltimer::getPeriodicInterval | ( | int32_t * | seconds,
|  | int32_t * | microseconds
| ) |  | const

Sets "seconds" and "microseconds" to the timer's periodic interval values.

bool intervaltimer::getTimeRemaining | ( | int32_t * | seconds,
|  | int32_t * | microseconds
| ) |  | const

Sets "seconds" and "microseconds" to the time remaining before the timer will raise the signal.

void intervaltimer::initialize | ( |  | ) |

Sets (or resets) the initial and periodic intervals to 0 seconds and 0 microseconds.

void intervaltimer::setInitialInterval | ( | int32_t | seconds,
|  | int32_t | microseconds
| ) |  |

Sets the timer's initial interval to "seconds" seconds and "microseconds" microseconds.

void intervaltimer::setIntervals | ( | int32_t | seconds,
|  | int32_t | microseconds
| ) |  |

Sets the timer's initial and periodic intervals both to "seconds" seconds and "microseconds" microseconds.

void intervaltimer::setPeriodicInterval | ( | int32_t | seconds,
|  | int32_t | microseconds
| ) |  |

Sets the timer's periodic interval to "seconds" seconds and "microseconds" microseconds.

bool intervaltimer::start | ( |  | ) | const

Starts (or restarts) the timer. It will first run for the initial interval, then raise a signal, then run over and over for the periodic interval, raising the signal at the end of each interval.

bool intervaltimer::start | ( | int32_t * | seconds,
|  | int32_t * | microseconds
| ) |  | const

Starts (or restarts) the timer. It will first run for the initial interval, then raise a signal, then run over and over for the periodic interval, raising the signal at the end of each interval. "seconds" and "microseconds" will be set to the interval that the timer was using prior to calling start().

bool intervaltimer::stop | ( |  | ) |

Stops the currently running timer, but preserves it's initial and perodic intervals.