ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/zoe/trunk/Stamp.cpp
Revision: 25
Committed: 2004-07-17T16:29:02-07:00 (20 years, 11 months ago) by douglas
File size: 796 byte(s)
Log Message:
RSS 2.0, baby!

File Contents

# User Rev Content
1 douglas 21 // Zoe AIM Away Message RSS Feed Generator
2     //
3     // Seth King and Douglas Thrift
4     //
5     // $Id$
6    
7     #include "Stamp.hpp"
8    
9     Stamp::Stamp(int day, int month, int year, int hour, int minute, int second)
10     {
11     stamp.tm_mday = day;
12     stamp.tm_mon = month;
13     stamp.tm_year = year;
14     stamp.tm_hour = hour;
15     stamp.tm_min = minute;
16     stamp.tm_sec = second;
17    
18     timegm(&stamp);
19     }
20    
21     Stamp::Stamp(const ext::String& when)
22     {
23 douglas 24 strptime(when.NullTerminate(), "%a, %d %b %Y %T %Z", &stamp);
24 douglas 21 }
25    
26 douglas 25 Stamp::operator ext::String() const
27 douglas 21 {
28     char when[30];
29    
30 douglas 24 std::strftime(when, 30, "%a, %d %b %Y %T GMT", &stamp);
31 douglas 21
32     return when;
33     }
34    
35     Stamp Stamp::operator+(Stamp stamp)
36     {
37     return timegm(&this->stamp) + timegm(&stamp.stamp);
38     }
39    
40     Stamp Stamp::operator-(Stamp stamp)
41     {
42     return std::time_t(difftime(timegm(&this->stamp), timegm(&stamp.stamp)));
43     }

Properties

Name Value
svn:eol-style native
svn:keywords Id