diff options
| author | Henrik Rydberg <rydberg@euromail.se> | 2011-10-08 20:30:28 +0200 |
|---|---|---|
| committer | Henrik Rydberg <rydberg@euromail.se> | 2011-10-08 20:30:28 +0200 |
| commit | 5df79c53745fde5d6c3340a2979b1429cd5892c1 (patch) | |
| tree | 1a81af141708b826e9c61e8a04019994fcca8298 /src/mt/dates.h | |
Initial import of htcd system 1.0
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'src/mt/dates.h')
| -rw-r--r-- | src/mt/dates.h | 49 |
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 | |||
| 26 | const time_t SEC_PER_DAY=86400; | ||
| 27 | const int MAXLANG=2; | ||
| 28 | const mstring LANG[MAXLANG]={"en","sv"}; | ||
| 29 | |||
| 30 | inline time_t Now() { return time(0); } | ||
| 31 | inline time_t Days(int days) { return days*SEC_PER_DAY; } | ||
| 32 | |||
| 33 | time_t Today(time_t); | ||
| 34 | time_t Sunday(time_t); | ||
| 35 | |||
| 36 | const mstring& Week(int lang,time_t t); | ||
| 37 | const mstring& Month(int lang,time_t t); | ||
| 38 | |||
| 39 | const mstring& SWeek(int lang,time_t t); | ||
| 40 | const mstring& SMonth(int lang,time_t t); | ||
| 41 | |||
| 42 | mstring httpTime(time_t t); | ||
| 43 | mstring htcTime(int lang,time_t t); | ||
| 44 | time_t htcTime(int lang,const sref& date); | ||
| 45 | time_t cvtTime(const sref& code); | ||
| 46 | |||
| 47 | int Language(const sref& s); | ||
| 48 | |||
| 49 | #endif | ||
