BrailleTutorNS::TimeInterval Struct Reference

A class for event timestamps and time intervals. More...

#include <Types.h>

List of all members.

Public Member Functions

void invariant ()
 Reexpress secs and msecs to satisfy the representation invariant.
 operator double () const
 Cast operator automatically makes a floating point time value in seconds.
 TimeInterval ()
 Constructor: create a zero length interval.
 TimeInterval (const unsigned int &my_secs, const unsigned short int &my_msecs)
 Constructor: specify seconds and milliseconds explicitly.
 TimeInterval (const double &my_secs)
 Constructor: specify a floating point time value in seconds.
void sleep () const
 Sleep (portably) for this time interval.

Static Public Member Functions

static TimeInterval now ()
 Named constructor: generate a timestamp as time since some epoch.

Public Attributes

unsigned int secs
 Interval duration rounded down to the nearest smaller second.
unsigned short int msecs
 Number of milliseconds in interval duration - secs.


Detailed Description

A class for event timestamps and time intervals.

This class furnishes timestamps for Braille Tutor events, as well as a representation for other time intervals. Time is represented as the sum of seconds and milliseconds, and for timestamps the class indicates time since some epoch (c.f. POSIX's struct timeb in ftime(3)). The specific epoch is not specified and may change between different instances of the same program; since timestamps are mainly used for computing relative times, however, this is not expected to be a problem. Additional operators support basic arithmetic operations (addition etc.) on time values.

Abstraction function: A time interval of xxx.yyy seconds is represented in fixed-point 3-decimal place resolution with xxx in secs and yyy in msecs.

Representation invariant: msecs is always in [0-999].


The documentation for this struct was generated from the following file:
Generated on Fri Nov 16 14:50:27 2007 for Braille Tutor Interface Library by  doxygen 1.5.3