15 |
|
class Period |
16 |
|
{ |
17 |
|
private: |
18 |
< |
int seconds; |
18 |
> |
std::time_t seconds; |
19 |
|
public: |
20 |
< |
Period(int period) : seconds(period * Seconds) {} |
21 |
< |
operator int() const { return seconds; } |
20 |
> |
Period(std::time_t period) : seconds(period * Seconds) {} |
21 |
> |
operator std::time_t() const { return seconds; } |
22 |
|
}; |
23 |
|
|
24 |
|
typedef Period<60> Minute; |
34 |
|
Stamp(std::time_t when = std::time(NULL)) : when(when) { gmtime_r(&when, |
35 |
|
&stamp); } |
36 |
|
Stamp(const ext::String& when); |
37 |
+ |
ext::String get822() const; |
38 |
+ |
ext::String getW3() const; |
39 |
+ |
ext::String getDate() const; |
40 |
+ |
ext::String getTime() const; |
41 |
+ |
void setSeconds(int seconds); |
42 |
+ |
void setMinutes(int minutes); |
43 |
|
operator ext::String() const; |
44 |
|
Stamp operator+(std::time_t seconds) const { return when + seconds; } |
45 |
|
Stamp operator-(std::time_t seconds) const { return when - seconds; } |
46 |
|
bool operator<(const Stamp& stamp) const { return when < stamp.when; } |
47 |
|
}; |
48 |
|
|
49 |
< |
inline std::ostream& operator<<(std::ostream& sout, const Stamp& stamp) { return sout << ext::String(stamp); } |
49 |
> |
inline std::ostream& operator<<(std::ostream& sout, const Stamp& stamp) |
50 |
> |
{ |
51 |
> |
return sout << ext::String(stamp); |
52 |
> |
} |
53 |
|
|
54 |
|
#endif // _Stamp_hpp_ |