Removed ical_dezonify() from the citserver build ... it isn't used anymore
[citadel.git] / citadel / default_timezone.c
1 /*
2  * Copyright (c) 1987-2018 by the citadel.org team
3  *
4  * This program is open source software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License version 3.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  */
12
13
14 #include "sysdep.h"
15 #include <stdlib.h>
16 #include <unistd.h>
17 #include <sys/types.h>
18 #include <limits.h>
19 #include <stdio.h>
20 #include <string.h>
21 #include <strings.h>
22 #include <syslog.h>
23 #include <libical/ical.h>
24 #include <libcitadel.h>
25 #include "citadel.h"
26 #include "server.h"
27 #include "citserver.h"
28 #include "sysdep_decls.h"
29 #include "support.h"
30 #include "config.h"
31 #include "default_timezone.h"
32 #include "ctdl_module.h"
33
34
35 /*
36  * Figure out which time zone needs to be used for timestamps that are
37  * not UTC and do not have a time zone specified.
38  */
39 icaltimezone *get_default_icaltimezone(void) {
40
41         icaltimezone *zone = NULL;
42         char *default_zone_name = CtdlGetConfigStr("c_default_cal_zone");
43
44         if (!zone) {
45                 zone = icaltimezone_get_builtin_timezone(default_zone_name);
46         }
47         if (!zone) {
48                 syslog(LOG_ERR, "ical: Unable to load '%s' time zone.  Defaulting to UTC.", default_zone_name);
49                 zone = icaltimezone_get_utc_timezone();
50         }
51         if (!zone) {
52                 syslog(LOG_ERR, "ical: unable to load UTC time zone!");
53         }
54
55         return zone;
56 }