time_stamp Class Reference

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

#include <time_stamp.h>

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.
istring text_form (stamp_display_style style=STAMP_RELATIVE) const
 returns a simple textual representation of the time_stamp.
bool operator< (const time_stamp &that) const
bool operator> (const time_stamp &that) const
bool operator<= (const time_stamp &that) const
bool operator>= (const time_stamp &that) const
bool operator!= (const time_stamp &that) const
bool operator== (const time_stamp &that) const


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 32 of file time_stamp.h.


Member Typedef Documentation

typedef double time_stamp::time_representation

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

Definition at line 36 of file time_stamp.h.


Member Enumeration Documentation

enum time_stamp::stamp_display_style

Enumerator:
STAMP_RELATIVE 
STAMP_ABSOLUTE 

Definition at line 54 of file time_stamp.h.


Constructor & Destructor Documentation

time_stamp::time_stamp (  ) 

creates a time_stamp containing the current time.

Definition at line 25 of file time_stamp.cpp.

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 27 of file time_stamp.cpp.

References reset().


Member Function Documentation

void time_stamp::reset (  ) 

sets the stamp time back to now.

Definition at line 30 of file time_stamp.cpp.

Referenced by ADD(), post_office::deliver_mail_on_route(), spocket_tester::do_a_receive(), broadcast_spocket_tester::do_a_receive(), cromp_server::drop_dead_clients(), buffer::dump(), FIND(), socket_minder::handle_pending_connecters(), shutdown_alerter::launch_console(), main(), octopus::periodic_cleaning(), buffer::release(), throughput_counter::reset(), transition_map::reset(), hoople_api::managed_time_stamp::reset(), run_test_30(), state_machine::set_state(), ithread::start(), connection::state(), buffer::store_packet(), test_byte_table(), test_string_table(), and time_stamp().

void time_stamp::reset ( time_representation  offset  ) 

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

Definition at line 78 of file time_stamp.cpp.

time_representation time_stamp::value (  )  const [inline]

returns the time_stamp in terms of the lower level type.

Definition at line 51 of file time_stamp.h.

Referenced by ADD(), ADD2(), post_office::deliver_mail_on_route(), spocket_tester::do_a_receive(), broadcast_spocket_tester::do_a_receive(), spocket_tester::do_a_send(), broadcast_spocket_tester::do_a_send(), FIND(), main(), spocket_tester::perform_test(), broadcast_spocket_tester::perform_test(), grid_processor::process_grid_files(), run_test_01(), run_test_30(), throughput_counter::stop(), test_byte_table(), test_string_table(), test_tc_table(), heartbeat::time_left(), throughput_counter::total_time(), and hoople_api::managed_time_stamp::value().

istring 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 32 of file time_stamp.cpp.

References absolute_value(), negative(), SECOND_ms, istring::SPRINTF, and STAMP_RELATIVE.

Referenced by periodicity::per_text_form(), hysteresis::text_form(), heartbeat::text_form(), hoople_api::managed_time_stamp::text_form(), connection::text_form(), linked_buffer::text_form(), and buffer::text_form().

bool time_stamp::operator< ( const time_stamp that  )  const [inline]

Definition at line 65 of file time_stamp.h.

References _stamp.

bool time_stamp::operator> ( const time_stamp that  )  const [inline]

Definition at line 67 of file time_stamp.h.

References _stamp.

bool time_stamp::operator<= ( const time_stamp that  )  const [inline]

Definition at line 69 of file time_stamp.h.

References _stamp.

bool time_stamp::operator>= ( const time_stamp that  )  const [inline]

Definition at line 71 of file time_stamp.h.

References _stamp.

bool time_stamp::operator!= ( const time_stamp that  )  const [inline]

Definition at line 73 of file time_stamp.h.

References _stamp.

bool time_stamp::operator== ( const time_stamp that  )  const [inline]

Definition at line 75 of file time_stamp.h.

References _stamp.


The documentation for this class was generated from the following files:
Generated on Fri Nov 28 04:31:03 2008 for HOOPLE Libraries by  doxygen 1.5.1