timely::time_stamp Class Reference

Represents a point in time relative to the operating system startup time. More...

#include <time_stamp.h>

Inheritance diagram for timely::time_stamp:
Inheritance graph
[legend]
Collaboration diagram for timely::time_stamp:
Collaboration graph
[legend]

List of all members.

Public Types

enum  stamp_display_style { STAMP_RELATIVE, STAMP_ABSOLUTE }
typedef double time_representation
 the representation of time for this universe, measured in milliseconds.

Public Member Functions

 time_stamp ()
 creates a time_stamp containing the current time.
 time_stamp (time_representation offset)
 creates a stamp after the current time by "offset" milliseconds.
void reset ()
 sets the stamp time back to now.
void reset (time_representation offset)
 sets the stamp forward by "offset" similar to the second constructor.
time_representation value () const
 returns the time_stamp in terms of the lower level type.
basis::astring text_form (stamp_display_style style=STAMP_RELATIVE) const
 returns a simple textual representation of the time_stamp.
virtual bool less_than (const basis::orderable &that) const
virtual bool equal_to (const basis::equalizable &that) const

Static Public Member Functions

static double rolling_uptime ()
 give the OS uptime in a more durable form that handles rollovers.
static basis::astring notarize (bool add_space=true)
 a useful method for getting a textual version of the time "right now".
static timeval fill_timeval_ms (int milliseconds)
 returns a timeval system object that represents the "milliseconds".

Detailed Description

Represents a point in time relative to the operating system startup time.

This duration is measured in milliseconds. This class provides a handy way of measuring relative durations at the millisecond time scale. Unfortunately, operating systems that reckon their millisecond uptime in 32 bit integers will suffer from a rollover problem every 49 days or so, but this class corrects this issue.

Definition at line 37 of file time_stamp.h.


Member Typedef Documentation

the representation of time for this universe, measured in milliseconds.

Definition at line 41 of file time_stamp.h.


Member Enumeration Documentation

Enumerator:
STAMP_RELATIVE 
STAMP_ABSOLUTE 

Definition at line 62 of file time_stamp.h.


Constructor & Destructor Documentation

timely::time_stamp::time_stamp (  ) 

creates a time_stamp containing the current time.

Definition at line 46 of file time_stamp.cpp.

timely::time_stamp::time_stamp ( time_representation  offset  ) 

creates a stamp after the current time by "offset" milliseconds.

negative offsets are allowed, in which case the stamp will be prior to the current time.

Definition at line 48 of file time_stamp.cpp.

References reset().


Member Function Documentation

virtual bool timely::time_stamp::equal_to ( const basis::equalizable that  )  const [inline, virtual]

Implements basis::equalizable.

Definition at line 85 of file time_stamp.h.

timeval timely::time_stamp::fill_timeval_ms ( int  milliseconds  )  [static]

returns a timeval system object that represents the "milliseconds".

if "milliseconds" is zero, then the returned timeval will represent zero time passing (rather than infinite duration as some functions assume).

Definition at line 133 of file time_stamp.cpp.

virtual bool timely::time_stamp::less_than ( const basis::orderable that  )  const [inline, virtual]

Implements basis::orderable.

Definition at line 79 of file time_stamp.h.

basis::astring timely::time_stamp::notarize ( bool  add_space = true  )  [static]

a useful method for getting a textual version of the time "right now".

this was formerly known as a very useful method called 'utilitytimestamp'. that naming was fairly abusive to keep straight from the time_stamp class, so the functionality has been absorbed.

Definition at line 37 of file time_stamp.cpp.

References timely::clock_time::MILITARY, timely::clock_time::MILLISECONDS, timely::now(), and timely::time_locus::text_form_long().

void timely::time_stamp::reset ( time_representation  offset  ) 

sets the stamp forward by "offset" similar to the second constructor.

Definition at line 101 of file time_stamp.cpp.

void timely::time_stamp::reset (  ) 
double timely::time_stamp::rolling_uptime (  )  [static]

give the OS uptime in a more durable form that handles rollovers.

Definition at line 113 of file time_stamp.cpp.

References timely::__rollover_point.

astring timely::time_stamp::text_form ( stamp_display_style  style = STAMP_RELATIVE  )  const

returns a simple textual representation of the time_stamp.

if the "style" is ABSOLUTE, then the stamp is shown in H:M:S.ms form based on the system uptime. if the "style" is RELATIVE, then the stamp is shown as an offset from now.

Definition at line 53 of file time_stamp.cpp.

References basis::absolute_value(), basis::negative(), basis::SECOND_ms, and STAMP_RELATIVE.

Referenced by processes::heartbeat::text_form().

time_representation timely::time_stamp::value (  )  const [inline]

The documentation for this class was generated from the following files:
Generated on Sat Jan 28 04:26:04 2012 for hoople2 project by  doxygen 1.6.3