OpenSync  0.22
opensync_time.h
1 #ifndef _OPENSYNC_TIME_H_
2 #define _OPENSYNC_TIME_H_
3 
4 /* Timeformat helper */
5 char *osync_time_timestamp(const char *vtime);
6 char *osync_time_datestamp(const char *vtime);
7 osync_bool osync_time_isdate(const char *vformat);
8 osync_bool osync_time_isutc(const char *vformat);
9 //char *osync_time_set_vtime(const char *vtime, const char *time, osync_bool is_utc);
10 
11 /* Timetype helper */
12 struct tm *osync_time_vtime2tm(const char *vtime);
13 char *osync_time_tm2vtime(const struct tm *time, osync_bool is_utc);
14 time_t osync_time_vtime2unix(const char *vtime, int offset);
15 char *osync_time_unix2vtime(const time_t *timestamp);
16 time_t osync_time_tm2unix(const struct tm *tmtime);
17 struct tm *osync_time_unix2tm(const time_t *timestamp);
18 
19 /* Timezone helper */
20 /* System Timezone-Reliable Helpers */
21 int osync_time_timezone_diff(const struct tm *time);
22 struct tm *osync_time_tm2utc(const struct tm *ltime, int offset);
23 struct tm *osync_time_tm2localtime(const struct tm *utime, int offset);
24 char *osync_time_vtime2utc(const char* localtime, int offset);
25 char *osync_time_vtime2localtime(const char* utc, int offset);
26 
27 /* XXX This functions should only be used as workaround for plugins which
28  only supports localtime without any timezone information. */
29 char *osync_time_vcal2localtime(const char *vcal);
30 char *osync_time_vcal2utc(const char *vcal);
31 
32 /* Smart Timezone Helpers */
33 // TODO
34 
35 /* Alarm Duration Timeformat helper */
36 char *osync_time_sec2alarmdu(int seconds);
37 int osync_time_alarmdu2sec(const char *alarm);
38 
39 /* Timezone ID helper */
40 int osync_time_str2wday(const char *weekday);
41 struct tm *osync_time_relative2tm(const char *byday, const int bymonth, const int year);
42 int osync_time_utcoffset2sec(const char *offset);
43 
44 #endif // _OPENSYNC_TIME_H_
45