# HTTPDate¶

class HTTPDate

A container for an HTTP-legal time/date indication. This can accept a string from an HTTP header and will decode it into a C time_t value; conversely, it can accept a time_t value and encode it for output as a string.

Inheritance diagram

HTTPDate(void)
HTTPDate(time_t time)
HTTPDate(std::string const &format)
HTTPDate(HTTPDate const &copy)

Decodes the string into a sensible date. Returns 0 (!is_valid()) if the string cannot be correctly decoded.

int compare_to(HTTPDate const &other) const

Returns a number less than zero if this HTTPDate sorts before the other one, greater than zero if it sorts after, or zero if they are equivalent.

std::string get_string(void) const
time_t get_time(void) const

Returns the date as a C time_t value.

bool input(std::istream &in)
bool is_valid(void) const

Returns true if the date is meaningful, or false if it is -1 (which generally indicates the source string could not be parsed.)

HTTPDate now(void)

Returns an HTTPDate that represents the current time and date.

void output(std::ostream &out) const