libi2ncommon: (gerd) add empty WEEK constructor
[libi2ncommon] / src / timefunc.hxx
CommitLineData
e93545dd
GE
1/***************************************************************************
2 timecvt.hxx - description
3 -------------------
4 begin : Fri May 11 2001
5 copyright : (C) 2001 by STYLETEC
6 email : info@styletec.de
7 ***************************************************************************/
8
9#ifndef __TIMEFUNC_HXX
10#define __TIMEFUNC_HXX
11
f1499910
GE
12#include <bitset>
13
e93545dd
GE
14double prec_time(void);
15
16int date_to_seconds(const std::string &date);
17
18std::string make_nice_time(int seconds);
19std::string format_full_time(int seconds);
20
f1499910
GE
21class WEEK
22{
23 private:
24 std::bitset<7> days;
25
26 public:
27 enum WEEKDAY { SU=0, MO=1, TU=2, WE=3, TH=4, FR=5, SA=6 };
28
29 // throws out_of_range if illegal week
30 WEEK(const std::string& daystring);
31
32 WEEK(const std::bitset<7> &days)
33 : days(days)
34 { }
35
6781ce49
GE
36 WEEK()
37 { }
38
f1499910
GE
39 void clear()
40 { days.reset(); }
41
42 operator std::bitset<7>() const
43 { return days; }
44
45 std::string get_daystring() const;
46 std::string get_displaystring() const;
47 std::string get_netfilterstring() const;
48
49 static std::string get_day_display(WEEKDAY day);
50 static std::string get_english_display(WEEKDAY day);
51};
52
e93545dd 53#endif