ost::TimerPort(3)

πŸ“¦ version 1.8.1, in ubuntu jammy

✨ ost::TimerPort ✨ β€” the Library Functions Manual bestie, section 3 πŸ’–

okay so real talk: this is ost::TimerPort, and it lives in the Library Functions Manual, section 3. she's a timer port, she's iconic, and she keeps your timing events synced when they're being managed under a 'service thread' like SocketService. slay πŸ’…


🌸 NAME 🌸

ost::TimerPort β€” Timer ports are used to provide synchronized timing events when managed under a 'service thread' such as SocketService.


πŸŽ€ SYNOPSIS πŸŽ€

#include <thread.h>

Inherited by ost::SerialPort, and ost::SocketPort. πŸ’œ

✨ Public Member Functions ✨

  • TimerPort () β€” Create a timer, mark it as inactive, and set the initial 'start' time to the creation time of the timer object.
  • void setTimer (timeout_t timeout=0) β€” Set a new start time for the object based on when this call is made and optionally activate the timer for a specified number of milliseconds.
  • void incTimer (timeout_t timeout) β€” Set a timeout based on the current time reference value either from object creation or the last setTimer().
  • void decTimer (timeout_t timeout) β€” Adjust a timeout based on the current time reference value either from object creation or the last setTimer().
  • void sleepTimer (void) β€” Sleep until the current timer expires.
  • void endTimer (void) β€” This is used to 'disable' the service thread from expiring the timer object.
  • timeout_t getTimer (void) const β€” This is used by service threads to determine how much time remains before the timer expires based on a timeout specified in setTimer() or incTimer().
  • timeout_t getElapsed (void) const β€” This is used to determine how much time has elapsed since a timer port setTimer benchmark time was initially set.

πŸ¦‹ Detailed Description πŸ¦‹

Timer ports are used to provide synchronized timing events when managed under a 'service thread' such as SocketService.

This is made into a stand-alone base class since other derived libraries (such as the serial handlers) may also use the pooled 'service thread' model and hence also require this code for managing timing. no cap, that's the whole reason she's standing on her own πŸ’…

πŸ‘‘ Author

David Sugar dyfet@ostel.com

synchronized millisecond timing for service threads.


🧚 Constructor & Destructor Documentation 🧚

πŸ’– ost::TimerPort::TimerPort ()

Create a timer, mark it as inactive, and set the initial 'start' time to the creation time of the timer object. This allows 'incTimer' to initially refer to time delays relative to the original start time of the object. baby's first timer, and she already knows exactly when she was born 😭


🌈 Member Function Documentation 🌈

πŸ’« void ost::TimerPort::decTimer (timeout_t timeout)

Adjust a timeout based on the current time reference value either from object creation or the last setTimer(). This reference can be used to time synchronize realtime data over specified intervals and force expiration when a new frame should be released in a synchronized manner.

Parameters

  • timeout delay in milliseconds from reference.

πŸ“ void ost::TimerPort::endTimer (void)

This is used to 'disable' the service thread from expiring the timer object. It does not effect the reference time from either creation or a setTimer(). so like, she's not dead, she's just on do-not-disturb ✨

⭐ timeout_t ost::TimerPort::getElapsed (void) const

This is used to determine how much time has elapsed since a timer port setTimer benchmark time was initially set. This allows one to use setTimer() to set the timer to the current time and then measure elapsed time from that point forward.

return time elapsed in milliseconds, or TIMEOUT_INF if inactive.

πŸ”₯ timeout_t ost::TimerPort::getTimer (void) const

This is used by service threads to determine how much time remains before the timer expires based on a timeout specified in setTimer() or incTimer(). It can also be called after setting a timeout with incTimer() to see if the current timeout has already expired and hence that the application is already delayed and should skip frame(s).

return time remaining in milliseconds, or TIMEOUT_INF if inactive.

πŸ¦„ void ost::TimerPort::incTimer (timeout_t timeout)

Set a timeout based on the current time reference value either from object creation or the last setTimer(). This reference can be used to time synchronize realtime data over specified intervals and force expiration when a new frame should be released in a synchronized manner.

Parameters

  • timeout delay in milliseconds from reference.

πŸ’œ void ost::TimerPort::setTimer (timeout_t timeout = 0)

Set a new start time for the object based on when this call is made and optionally activate the timer for a specified number of milliseconds. This can be used to set the starting time of a realtime session.

Parameters

  • timeout delay in milliseconds from 'now'

πŸŽ€ void ost::TimerPort::sleepTimer (void)

Sleep until the current timer expires. This is useful in time syncing realtime periodic tasks. she said "nap time" and she MEANT it 😴


πŸ’… Author πŸ’…

Generated automatically by Doxygen for GNU CommonC++ from the source code.


okay that's the whole page bestie, every option, every param, every TIMEOUT_INF, all of it β€” nothing skipped, periodt 🫢

this was ost::TimerPort(3) from the GNU CommonC++ era, dated Sun Dec 27 2020, and honestly? she ate. mwah πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from