summaryrefslogtreecommitdiff
path: root/src/mt/dates.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mt/dates.h')
-rw-r--r--src/mt/dates.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/mt/dates.h b/src/mt/dates.h
new file mode 100644
index 0000000..fe05245
--- /dev/null
+++ b/src/mt/dates.h
@@ -0,0 +1,49 @@
1/*************************************************************************
2 *
3 * HTCd - Copyright (C) 1998-2006 Henrik Rydberg
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#ifndef DATESH
21#define DATESH
22
23#include <mt/mstring.h>
24#include <time.h>
25
26const time_t SEC_PER_DAY=86400;
27const int MAXLANG=2;
28const mstring LANG[MAXLANG]={"en","sv"};
29
30inline time_t Now() { return time(0); }
31inline time_t Days(int days) { return days*SEC_PER_DAY; }
32
33time_t Today(time_t);
34time_t Sunday(time_t);
35
36const mstring& Week(int lang,time_t t);
37const mstring& Month(int lang,time_t t);
38
39const mstring& SWeek(int lang,time_t t);
40const mstring& SMonth(int lang,time_t t);
41
42mstring httpTime(time_t t);
43mstring htcTime(int lang,time_t t);
44time_t htcTime(int lang,const sref& date);
45time_t cvtTime(const sref& code);
46
47int Language(const sref& s);
48
49#endif