// Zoe AIM Away Message RSS Feed Generator // // Seth King and Douglas Thrift // // $Id$ #include "Stamp.hpp" Stamp::Stamp(int day, int month, int year, int hour, int minute, int second) { stamp.tm_mday = day; stamp.tm_mon = month; stamp.tm_year = year; stamp.tm_hour = hour; stamp.tm_min = minute; stamp.tm_sec = second; timegm(&stamp); } Stamp::Stamp(const ext::String& when) { ::strptime(when.NullTerminate(), "%a, %d %b %Y %k:%M:%S %Z", &stamp); } Stamp::operator ext::String() { char when[30]; std::strftime(when, 30, "%a, %d %b %Y %k:%M:%S GMT", &stamp); return when; } Stamp Stamp::operator+(Stamp stamp) { return timegm(&this->stamp) + timegm(&stamp.stamp); } Stamp Stamp::operator-(Stamp stamp) { return std::time_t(difftime(timegm(&this->stamp), timegm(&stamp.stamp))); }