feisty meow concerns codebase
2.140
|
Represents a point in time relative to the operating system startup time. More...
#include <time_stamp.h>
Public Types | |
enum | stamp_display_style { STAMP_RELATIVE , STAMP_ABSOLUTE } |
typedef double | time_representation |
the representation of time for this universe, measured in milliseconds. More... | |
Public Member Functions | |
DEFINE_CLASS_NAME ("time_stamp") | |
time_stamp () | |
creates a time_stamp containing the current time. More... | |
time_stamp (time_representation offset) | |
creates a stamp after the current time by "offset" milliseconds. More... | |
void | reset () |
sets the stamp time back to now. More... | |
void | reset (time_representation offset) |
sets the stamp forward by "offset" similar to the second constructor. More... | |
time_representation | value () const |
returns the time_stamp in terms of the lower level type. More... | |
basis::astring | text_form (stamp_display_style style=STAMP_RELATIVE) const |
returns a simple textual representation of the time_stamp. More... | |
virtual bool | less_than (const basis::orderable &that) const |
virtual bool | equal_to (const basis::equalizable &that) const |
Public Member Functions inherited from basis::orderable | |
virtual bool | operator< (const orderable &s2) const |
the virtual method for object ordering. More... | |
Public Member Functions inherited from basis::equalizable | |
virtual bool | operator== (const equalizable &s2) const |
the virtual method for object equality. More... | |
Static Public Member Functions | |
static double | rolling_uptime () |
give the OS uptime in a more durable form that handles rollovers. More... | |
static basis::astring | notarize (bool add_space=true) |
a useful method for getting a textual version of the time "right now". More... | |
static void | fill_timeval_ms (timeval &time_point, int milliseconds) |
returns a timeval system object that represents the "milliseconds". More... | |
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.
typedef double timely::time_stamp::time_representation |
the representation of time for this universe, measured in milliseconds.
Definition at line 42 of file time_stamp.h.
Enumerator | |
---|---|
STAMP_RELATIVE | |
STAMP_ABSOLUTE |
Definition at line 64 of file time_stamp.h.
timely::time_stamp::time_stamp | ( | ) |
creates a time_stamp containing the current time.
Definition at line 54 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 56 of file time_stamp.cpp.
References reset().
timely::time_stamp::DEFINE_CLASS_NAME | ( | "time_stamp" | ) |
|
inlinevirtual |
Implements basis::equalizable.
Definition at line 87 of file time_stamp.h.
|
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 141 of file time_stamp.cpp.
|
inlinevirtual |
Implements basis::orderable.
Definition at line 81 of file time_stamp.h.
|
static |
a useful method for getting a textual version of the time "right now".
this was formerly known as a very useful method called 'utility::timestamp'. that naming was fairly abusive to keep straight from the time_stamp class, so the functionality has been absorbed.
Definition at line 45 of file time_stamp.cpp.
References timely::now(), and timely::time_locus::text_form_long().
void timely::time_stamp::reset | ( | ) |
sets the stamp time back to now.
Definition at line 59 of file time_stamp.cpp.
Referenced by processes::post_office::deliver_mail_on_route(), cromp::cromp_server::drop_dead_clients(), sockets::socket_minder::handle_pending_connecters(), application::hoople_service::launch_console(), octopi::octopus::periodic_cleaning(), sockets::throughput_counter::reset(), processes::transition_map::reset(), processes::state_machine::set_state(), processes::ethread::start(), and time_stamp().
void timely::time_stamp::reset | ( | time_representation | offset | ) |
sets the stamp forward by "offset" similar to the second constructor.
Definition at line 109 of file time_stamp.cpp.
|
static |
give the OS uptime in a more durable form that handles rollovers.
Definition at line 121 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 61 of file time_stamp.cpp.
References basis::absolute_value(), basis::negative(), basis::SECOND_ms, and STAMP_RELATIVE.
Referenced by processes::heartbeat::text_form().
|
inline |
returns the time_stamp in terms of the lower level type.
Definition at line 61 of file time_stamp.h.
Referenced by processes::post_office::deliver_mail_on_route(), spocket_tester::do_a_send(), broadcast_spocket_tester::do_a_send(), broadcast_spocket_tester::perform_test(), spocket_tester::perform_test(), sockets::throughput_counter::stop(), processes::heartbeat::time_left(), and sockets::throughput_counter::total_time().