41#ifndef _DWMTIMEVALUE_HH_
42#define _DWMTIMEVALUE_HH_
45 #include <sys/types.h>
47#if ((! __APPLE__) && (! __linux__))
48 #include <sys/timespec.h>
96 void Set(
const struct timeval & tv);
101 void Set(uint32_t secs, uint32_t usecs);
113 struct tm LocalTime() const;
154 std::istream &
Read(std::istream & is);
159 std::ostream &
Write(std::ostream & os)
const;
212 operator double ()
const;
This class encapsulates a time value beyond the UNIX epoch, with microsecond granularity.
Definition DwmTimeValue.hh:68
bool operator<(const TimeValue &tv) const
Less-than operator.
TimeValue(const struct timeval &tv)
Construct from a struct timeval.
uint64_t StreamedLength() const
Returns the number of bytes that would be written if one of the Write() members were called.
int Write(gzFile gzf) const
Writes the TimeValue to a gzFile.
bool operator==(const TimeValue &tv) const
Equal-to operator.
int BZRead(BZFILE *bzf)
Reads the TimeValue from a BZFILE pointer.
uint32_t Secs() const
Returns the seconds.
TimeValue(bool setNow=false)
Constructor.
std::istream & Read(std::istream &is)
Reads the TimeValue from an istream. Returns the istream.
void Set(uint32_t secs, uint32_t usecs)
Sets the TimeValue from the given secs and usecs.
size_t Write(FILE *f) const
Writes the TimeValue to a FILE pointer.
bool operator>(const TimeValue &tv) const
Greater-than operator.
std::ostream & Write(std::ostream &os) const
Writes the TimeValue to an ostream. Returns the ostream.
TimeValue(uint32_t secs, uint32_t usecs)
Construct from the given secs and usecs.
ssize_t Read(int fd)
Reads the TimeValue from a file descriptor.
void Set(const struct timeval &tv)
Sets the TimeValue from the given struct timeval tv.
uint32_t Usecs() const
Returns the residual microseconds.
ssize_t Write(int fd) const
Writes the TimeValue to a file descriptor.
bool operator>=(const TimeValue &tv) const
operator >=
int BZWrite(BZFILE *bzf) const
Writes the TimeValue to a BZFILE pointer.
void SetNow()
Sets the TimeValue to the current time.
int Read(gzFile gzf)
Reads the TimeValue from a gzFile.
size_t Read(FILE *f)
Reads the TimeValue from a FILE pointer.
bool operator<=(const TimeValue &tv) const
operator <=