OpenSync
0.22
|
00001 #ifndef _OPENSYNC_TIME_H_ 00002 #define _OPENSYNC_TIME_H_ 00003 00004 /* Timeformat helper */ 00005 char *osync_time_timestamp(const char *vtime); 00006 char *osync_time_datestamp(const char *vtime); 00007 osync_bool osync_time_isdate(const char *vformat); 00008 osync_bool osync_time_isutc(const char *vformat); 00009 //char *osync_time_set_vtime(const char *vtime, const char *time, osync_bool is_utc); 00010 00011 /* Timetype helper */ 00012 struct tm *osync_time_vtime2tm(const char *vtime); 00013 char *osync_time_tm2vtime(const struct tm *time, osync_bool is_utc); 00014 time_t osync_time_vtime2unix(const char *vtime, int offset); 00015 char *osync_time_unix2vtime(const time_t *timestamp); 00016 time_t osync_time_tm2unix(const struct tm *tmtime); 00017 struct tm *osync_time_unix2tm(const time_t *timestamp); 00018 00019 /* Timezone helper */ 00020 /* System Timezone-Reliable Helpers */ 00021 int osync_time_timezone_diff(const struct tm *time); 00022 struct tm *osync_time_tm2utc(const struct tm *ltime, int offset); 00023 struct tm *osync_time_tm2localtime(const struct tm *utime, int offset); 00024 char *osync_time_vtime2utc(const char* localtime, int offset); 00025 char *osync_time_vtime2localtime(const char* utc, int offset); 00026 00027 /* XXX This functions should only be used as workaround for plugins which 00028 only supports localtime without any timezone information. */ 00029 char *osync_time_vcal2localtime(const char *vcal); 00030 char *osync_time_vcal2utc(const char *vcal); 00031 00032 /* Smart Timezone Helpers */ 00033 // TODO 00034 00035 /* Alarm Duration Timeformat helper */ 00036 char *osync_time_sec2alarmdu(int seconds); 00037 int osync_time_alarmdu2sec(const char *alarm); 00038 00039 /* Timezone ID helper */ 00040 int osync_time_str2wday(const char *weekday); 00041 struct tm *osync_time_relative2tm(const char *byday, const int bymonth, const int year); 00042 int osync_time_utcoffset2sec(const char *offset); 00043 00044 #endif // _OPENSYNC_TIME_H_ 00045