libDwm-0.9.45
Dwm::TimeValue64 Class Reference

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

#include <DwmTimeValue64.hh>

Public Member Functions

 TimeValue64 (bool setNow=false)
 Constructor.
 
 TimeValue64 (const struct timeval &tv)
 Construct from a struct timeval.
 
 TimeValue64 (const struct timespec &ts)
 Construct from a struct timespec.
 
 TimeValue64 (const TimeValue &tv)
 Construct from a TimeValue.
 
 TimeValue64 (uint64_t secs, uint32_t usecs)
 Construct from the given secs and usecs.
 
void SetNow ()
 Sets the TimeValue64 to the current time.
 
void Set (const struct timeval &tv)
 Sets the TimeValue64 from the given struct timeval tv.
 
void Set (uint64_t secs, uint32_t usecs)
 Sets the TimeValue64 from the given secs and usecs.
 
uint64_t Secs () const
 Returns the seconds.
 
uint32_t Usecs () const
 Returns the residual microseconds.
 
struct tm LocalTime () const
 
bool operator< (const TimeValue64 &tv) const
 Less-than operator.
 
bool operator<= (const TimeValue64 &tv) const
 operator <=
 
bool operator> (const TimeValue64 &tv) const
 Greater-than operator.
 
bool operator>= (const TimeValue64 &tv) const
 operator >=
 
bool operator== (const TimeValue64 &tv) const
 Equal-to operator.
 
TimeValue64operator+= (const TimeValue64 &tv)
 
TimeValue64operator-= (const TimeValue64 &tv)
 
TimeValue64operator*= (uint32_t x)
 
TimeValue64operator/= (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 TimeValue64 from an istream. Returns the istream.
 
std::ostream & Write (std::ostream &os) const
 Writes the TimeValue64 to an ostream. Returns the ostream.
 
size_t Read (FILE *f)
 Reads the TimeValue64 from a FILE pointer.
 
size_t Write (FILE *f) const
 Writes the TimeValue64 to a FILE pointer.
 
ssize_t Read (int fd)
 Reads the TimeValue64 from a file descriptor.
 
ssize_t Write (int fd) const
 Writes the TimeValue64 to a file descriptor.
 
int Read (gzFile gzf)
 Reads the TimeValue64 from a gzFile.
 
int Write (gzFile gzf) const
 Writes the TimeValue64 to a gzFile.
 
int BZRead (BZFILE *bzf)
 Reads the TimeValue64 from a BZFILE pointer.
 
int BZWrite (BZFILE *bzf) const
 Writes the TimeValue64 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

◆ TimeValue64()

Dwm::TimeValue64::TimeValue64 ( 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::TimeValue64::BZRead ( BZFILE * bzf)

Reads the TimeValue64 from a BZFILE pointer.

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

◆ BZWrite()

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

Writes the TimeValue64 to a BZFILE pointer.

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

◆ Read() [1/3]

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

Reads the TimeValue64 from a FILE pointer.

Returns 1 on success, 0 on failure.

◆ Read() [2/3]

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

Reads the TimeValue64 from a gzFile.

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

◆ Read() [3/3]

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

Reads the TimeValue64 from a file descriptor.

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

◆ Write() [1/3]

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

Writes the TimeValue64 to a FILE pointer.

Returns 1 on success, 0 on failure.

◆ Write() [2/3]

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

Writes the TimeValue64 to a gzFile.

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

◆ Write() [3/3]

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

Writes the TimeValue64 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: