libDwm-0.9.45
Dwm::TimeValue Class Reference

This class encapsulates a time value beyond the UNIX epoch, with microsecond granularity. More...

#include <DwmTimeValue.hh>

Public Member Functions

 TimeValue (bool setNow=false)
 Constructor.
 
 TimeValue (const struct timeval &tv)
 Construct from a struct timeval.
 
 TimeValue (const struct timespec &ts)
 
 TimeValue (uint32_t secs, uint32_t usecs)
 Construct from the given secs and usecs.
 
void SetNow ()
 Sets the TimeValue to the current time.
 
void Set (const struct timeval &tv)
 Sets the TimeValue from the given struct timeval tv.
 
void Set (uint32_t secs, uint32_t usecs)
 Sets the TimeValue from the given secs and usecs.
 
uint32_t Secs () const
 Returns the seconds.
 
uint32_t Usecs () const
 Returns the residual microseconds.
 
struct tm LocalTime () const
 
bool operator< (const TimeValue &tv) const
 Less-than operator.
 
bool operator<= (const TimeValue &tv) const
 operator <=
 
bool operator> (const TimeValue &tv) const
 Greater-than operator.
 
bool operator>= (const TimeValue &tv) const
 operator >=
 
bool operator== (const TimeValue &tv) const
 Equal-to operator.
 
TimeValueoperator+= (const TimeValue &tv)
 
TimeValueoperator-= (const TimeValue &tv)
 
TimeValueoperator*= (uint32_t x)
 
TimeValueoperator/= (uint32_t x)
 
uint64_t StreamedLength () const
 Returns the number of bytes that would be written if one of the Write() members were called.
 
std::istream & Read (std::istream &is)
 Reads the TimeValue from an istream. Returns the istream.
 
std::ostream & Write (std::ostream &os) const
 Writes the TimeValue to an ostream. Returns the ostream.
 
size_t Read (FILE *f)
 Reads the TimeValue from a FILE pointer.
 
size_t Write (FILE *f) const
 Writes the TimeValue to a FILE pointer.
 
ssize_t Read (int fd)
 Reads the TimeValue from a file descriptor.
 
ssize_t Write (int fd) const
 Writes the TimeValue to a file descriptor.
 
int Read (gzFile gzf)
 Reads the TimeValue from a gzFile.
 
int Write (gzFile gzf) const
 Writes the TimeValue to a gzFile.
 
int BZRead (BZFILE *bzf)
 Reads the TimeValue from a BZFILE pointer.
 
int BZWrite (BZFILE *bzf) const
 Writes the TimeValue to a BZFILE pointer.
 
 operator double () const
 Returns value as a double (useful for printing).
 

Detailed Description

This class encapsulates a time value beyond the UNIX epoch, with microsecond granularity.

Constructor & Destructor Documentation

◆ TimeValue()

Dwm::TimeValue::TimeValue ( bool setNow = false)

Constructor.

Initializes to 0 (the UNIX epoch) if setNow is false, else initializaes to the current time.

Member Function Documentation

◆ BZRead()

int Dwm::TimeValue::BZRead ( BZFILE * bzf)

Reads the TimeValue from a BZFILE pointer.

Returns the number of bytes read on success (8), -1 on failure.

◆ BZWrite()

int Dwm::TimeValue::BZWrite ( BZFILE * bzf) const

Writes the TimeValue to a BZFILE pointer.

Returns the number of bytes written on success (8), -1 on failure.

◆ Read() [1/3]

size_t Dwm::TimeValue::Read ( FILE * f)

Reads the TimeValue from a FILE pointer.

Returns 1 on success, 0 on failure.

◆ Read() [2/3]

int Dwm::TimeValue::Read ( gzFile gzf)

Reads the TimeValue from a gzFile.

Returns the number of bytes read on success (8), -1 on failure.

◆ Read() [3/3]

ssize_t Dwm::TimeValue::Read ( int fd)

Reads the TimeValue from a file descriptor.

Returns the number of bytes read on success (8), -1 on failure.

◆ Write() [1/3]

size_t Dwm::TimeValue::Write ( FILE * f) const

Writes the TimeValue to a FILE pointer.

Returns 1 on success, 0 on failure.

◆ Write() [2/3]

int Dwm::TimeValue::Write ( gzFile gzf) const

Writes the TimeValue to a gzFile.

Returns the number of bytes written on success (8), -1 on failure.

◆ Write() [3/3]

ssize_t Dwm::TimeValue::Write ( int fd) const

Writes the TimeValue to a file descriptor.

Returns the number of bytes written on success (8), -1 on failure.


The documentation for this class was generated from the following file: