19 sequenceNumber = count;
31 return sequenceNumber;
41 return sequenceNumber >= 0;
60 std::int32_t header =
connection.expectInt32();
66 if (len != 2 && len != 3) {
105 std::snprintf(buf, 512,
"%d %.*g", sequenceNumber,
DBL_DIG, timeStamp);
121 return std::numeric_limits<int>::max();
129 if (sequenceNumber > getMaxCount() || sequenceNumber < 0) {
138 if (sequenceNumber > getMaxCount() || sequenceNumber < 0) {
#define BOTTLE_TAG_FLOAT64
#define BOTTLE_TAG_STRING
A mini-server for performing network communication in the background.
An interface for reading from a network connection.
An interface for writing to a network connection.
int getMaxCount() const
Get the maximum sequence number, after which an incrementing sequence should return to zero.
bool read(ConnectionReader &connection) override
Read this object from a network connection.
void update()
Set the timestamp to the current time, and increment the sequence number (wrapping to 0 if the sequen...
double getTime() const
Get the time stamp.
bool isValid() const
Check if this Stamp is valid.
bool write(ConnectionWriter &connection) const override
Write this object to a network connection.
Stamp()
Construct an invalid Stamp.
int getCount() const
Get the sequence number.
double now()
Return the current time in seconds, relative to an arbitrary starting point.