modify terminology:calendar->book,allday->localtime,normal->utime,svc->service
[platform/core/pim/calendar-service.git] / common / cal_time.h
1 /*
2  * Calendar Service
3  *
4  * Copyright (c) 2012 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 #ifndef __CALENDAR_SERVICE_TIME_H__
21 #define __CALENDAR_SERVICE_TIME_H__
22
23 #include <string.h>
24 #include <stdlib.h>
25 #include <glib.h>
26 #include <unicode/ucal.h>
27 #include <unicode/ustring.h>
28 #include <unicode/ustdio.h>
29 #include <unicode/udat.h>
30 #include <sys/types.h>
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36 void cal_time_get_registered_tzid_with_offset(int offset, char *registered_tzid, int tzid_size);
37 UCalendar *cal_time_open_ucal(int calendar_system_type, const char *tzid, int wkst);
38 char* cal_time_convert_ltos(const char *tzid, long long int lli, int is_allday);
39 long long int cal_time_convert_itol(const char *tzid, int y, int m, int d, int h, int min, int s);
40 long long int cal_time_get_now(void);
41 int cal_time_get_next_date(calendar_time_s *today, calendar_time_s *next);
42 void cal_time_u_cleanup(void);
43 void cal_time_get_tz_offset(const char *tz, time_t *zone_offset, time_t *dst_offset);
44 bool cal_time_in_dst(const char *tz, long long int t);
45 int cal_time_init(void);
46 void cal_time_fini(void);
47 long long int cal_time_convert_lli(char *p);
48 void cal_time_modify_caltime(calendar_time_s *caltime, long long int diff);
49 void cal_time_get_nth_wday(long long int t, int *nth, int *wday);
50 void cal_time_get_datetime(long long int t, int *y, int *m, int *d, int *h, int *n, int *s);
51 void cal_time_get_local_datetime(char *tzid, long long int t, int *y, int *m, int *d, int *h, int *n, int *s);
52 bool cal_time_is_available_tzid(char *tzid);
53
54 enum cal_extract_field {
55         CAL_MONTH,
56         CAL_DAY_OF_WEEK,
57         CAL_DATE,
58 };
59
60 #ifdef __cplusplus
61 }
62 #endif
63
64 #endif /* __CALENDAR_SERVICE_TIME_H__ */