#include <MaceTime.h>
In the model-checker, comparing two times is generally non-deterministic, to support interleaving differently timed events. Special care is taken for maps, which would behave awkwardly if they were sorted randomly and compared. The comparison functions call random if we are being simulated, and some versions support weights for biasing the results. Also, instead of multiplication, you should scale your time, which would properly maintain the taintedness of a time object.
Definition at line 94 of file MaceTime.h.
Public Member Functions | |
MaceTime () | |
default constructor (time 0) | |
MaceTime (uint64_t offset) | |
construct time at a specific offset | |
MaceTime (const MaceTime &other) | |
copy constructor | |
MaceTime & | operator= (const MaceTime &other) |
assigment operator | |
MaceTime & | operator= (uint64_t offset) |
assign MaceTime from a fixed offset | |
MaceTime | operator+ (const MaceTime &other) const |
add two MaceTime objects | |
MaceTime | operator- (const MaceTime &other) const |
subtract two MaceTime objects | |
bool | operator== (const MaceTime &other) const |
equality operator | |
bool | operator== (const uint64_t &other) const |
test equality against a fixed offset in microseconds. | |
bool | operator!= (const MaceTime &other) const |
inequality operator | |
bool | operator!= (const uint64_t &other) const |
test inequality against a fixed offset in microseconds. | |
bool | lessThan (const MaceTime &other, uint trueWeight=1, uint falseWeight=1) const |
version of less than which supports passed in weights | |
bool | greaterThan (const MaceTime &other, uint trueWeight=1, uint falseWeight=1) const |
version of greater than which supports passed in weights | |
bool | lessThanOrEqual (const MaceTime &other, uint trueWeight=1, uint falseWeight=1) const |
version of less than or equal which supports passed in weights | |
bool | greaterThanOrEqual (const MaceTime &other, uint trueWeight=1, uint falseWeight=1) const |
version of greater than or equal which supports passed in weights | |
bool | equals (const MaceTime &other, uint trueWeight=1, uint falseWeight=1) const |
version of equals which supports passed in weights | |
bool | notEquals (const MaceTime &other, uint trueWeight=1, uint falseWeight=1) const |
version of inequality which supports passed in weights | |
MaceTime | plus (const MaceTime &other) const |
add two MaceTimes | |
MaceTime | minus (const MaceTime &other) const |
subtract two MaceTimes | |
MaceTime | scaleBy (uint amount) const |
scale the time by a factor (multiplication or division) | |
MaceTime | scaleBy (double amount) const |
scale the time by a factor (multiplication or division) | |
void | serialize (std::string &s) const |
Encode the current object at the end of str as a bytestring in a compact format (and which doesn't require delimiters to parse). | |
bool | isZero () const |
tests the time against 0 | |
Static Public Member Functions | |
static const MaceTime & | min (const MaceTime &l, const MaceTime &r) |
returns the "real" minimum of two times, even in simulation. (Don't use unless you have good reason) | |
static MaceTime | currentTime () |
return an object corresponding to the present time. In most Mace code, this is just curtime | |
Friends | |
class | mace::KeyTraits< MaceTime > |
bool mace::MaceTime::lessThan | ( | const MaceTime & | other, | |
uint | trueWeight = 1 , |
|||
uint | falseWeight = 1 | |||
) | const [inline] |
version of less than which supports passed in weights
The weights should represent effective real-world likelihood of the two possible outcomes. These weights are used in simulation with tainted times to bias the execution to a realistic execution.
Definition at line 165 of file MaceTime.h.
References RandomUtil::randInt(), realtime, and tainted.
Referenced by greaterThanOrEqual().
bool mace::MaceTime::greaterThan | ( | const MaceTime & | other, | |
uint | trueWeight = 1 , |
|||
uint | falseWeight = 1 | |||
) | const [inline] |
version of greater than which supports passed in weights
The weights should represent effective real-world likelihood of the two possible outcomes. These weights are used in simulation to bias the execution to a realistic execution.
Definition at line 180 of file MaceTime.h.
References lessThanOrEqual().
bool mace::MaceTime::lessThanOrEqual | ( | const MaceTime & | other, | |
uint | trueWeight = 1 , |
|||
uint | falseWeight = 1 | |||
) | const [inline] |
version of less than or equal which supports passed in weights
The weights should represent effective real-world likelihood of the two possible outcomes. These weights are used in simulation with tainted times to bias the execution to a realistic execution.
Definition at line 191 of file MaceTime.h.
References RandomUtil::randInt(), realtime, and tainted.
Referenced by greaterThan().
bool mace::MaceTime::greaterThanOrEqual | ( | const MaceTime & | other, | |
uint | trueWeight = 1 , |
|||
uint | falseWeight = 1 | |||
) | const [inline] |
version of greater than or equal which supports passed in weights
The weights should represent effective real-world likelihood of the two possible outcomes. These weights are used in simulation with tainted times to bias the execution to a realistic execution.
Definition at line 207 of file MaceTime.h.
References lessThan().
bool mace::MaceTime::equals | ( | const MaceTime & | other, | |
uint | trueWeight = 1 , |
|||
uint | falseWeight = 1 | |||
) | const [inline] |
version of equals which supports passed in weights
The weights should represent effective real-world likelihood of the two possible outcomes. These weights are used in simulation with tainted times to bias the execution to a realistic execution.
Definition at line 218 of file MaceTime.h.
References RandomUtil::randInt(), realtime, and tainted.
Referenced by notEquals().
bool mace::MaceTime::notEquals | ( | const MaceTime & | other, | |
uint | trueWeight = 1 , |
|||
uint | falseWeight = 1 | |||
) | const [inline] |
version of inequality which supports passed in weights
The weights should represent effective real-world likelihood of the two possible outcomes. These weights are used in simulation with tainted times to bias the execution to a realistic execution.
Definition at line 233 of file MaceTime.h.
References equals().