22 #ifndef _TZ_SUPPORT_H_ 23 #define _TZ_SUPPORT_H_ 29 #define db_utime_to_string db_timestamp_to_string 30 #define db_string_to_utime db_string_to_timestamp 31 #define db_date_parse_utime db_date_parse_timestamp 44 #define TZLIB_SYMBOL_NAME_SIZE 64 45 #define MAX_LEN_OFFSET 10 47 #if defined(_WIN32) || defined(WINDOWS) || defined(WIN64) 48 #define SHLIB_EXPORT_PREFIX "__declspec(dllexport)" 49 #define LIB_TZ_NAME "libcubrid_timezones.dll" 51 #define makestring1(x) #x 52 #define makestring(x) makestring1(x) 54 #define SHLIB_EXPORT_PREFIX "" 56 "libcubrid_timezones.a(libcubrid_timezones.so." makestring(MAJOR_VERSION) ")" 58 #define SHLIB_EXPORT_PREFIX "" 59 #define LIB_TZ_NAME "libcubrid_timezones.so" 62 #define IS_LEAP_YEAR(y) ((((y) & 3) == 0) && ((((y) % 25) != 0) || (((y) & 15) == 0))) 65 #define DAYS_IN_MONTH(m) (31 - ((m) > 6 ? (m) - 7 : (m)) % 2) 67 #define IS_EMPTY_STR(s) ((s) == NULL || *(s) == '\0') 69 #define TZ_MAX_YEAR 9999 74 #define TZ_MAX_JULIAN_DATE 5373486 76 #define TZ_ZONE_ID_MAX 0x3ff 77 #define TZ_OFFSET_ID_MAX 0xff 78 #define TZ_DS_ID_MAX 0xff 82 #define DATE_DIFF_MATCH_SAFE_THRESHOLD_DAYS 2 83 #define DATE_DIFF_MATCH_SAFE_THRESHOLD_SEC 172800ll 85 #define TZ_DS_STRING_SIZE 10 87 #define ZONE_MAX 10000 118 #define TZ_IS_ZONE_VALID_DECODE_INFO(tz_info) \ 119 ((tz_info)->type == TZ_REGION_OFFSET \ 120 || (tz_info)->zone.zone_id != TZ_ZONE_ID_MAX) 122 #define TZ_IS_UTC_TZ_REGION(r) \ 123 ((r)->type == TZ_REGION_OFFSET && (r)->offset == 0) 126 #if defined (SA_MODE) 127 extern bool tz_Is_backward_compatible_timezone[];
128 extern bool tz_Compare_datetimetz_tz_id;
129 extern bool tz_Compare_timestamptz_tz_id;
140 extern void tz_timestamp_decode_sec (
int timestamp,
int *yearp,
int *monthsp,
int *dayp,
int *hoursp,
int *minutesp,
143 int *minutesp,
int *secondsp);
162 extern int tz_str_read_number (
const char *str,
const char *str_end,
const bool strict,
const bool read_sign,
163 int *val,
const char **str_next);
164 extern int tz_str_read_time (
const char *str,
const char *str_end,
bool need_minutes,
bool allow_sec60,
int *hour,
165 int *
min,
int *sec,
const char **str_next);
166 extern int tz_str_to_seconds (
const char *str,
const char *str_end,
int *sec,
const char **str_next,
167 const bool is_offset);
169 int *ds_rule_julian_date,
full_date_t * date_diff);
174 const char **end_tz_str);
178 extern int tz_id_to_str (
const TZ_ID * tz_id,
char *tz_str,
const int tz_str_size);
183 TZ_ID * src_tz_id_out,
TZ_ID * dest_tz_id_out);
185 const char *dest_zone,
int len_dest,
DB_DATETIME * dest_dt);
187 const char *dest_zone,
int len_dest,
DB_TIME * time_dest);
188 extern int tz_explain_tz_id (
const TZ_ID * tz_id,
char *tzr,
const int tzr_size,
char *tzdst,
const int tzdst_size,
196 const int zone_id,
const char *tzd,
const int tzd_len,
199 TZ_REGION * default_tz_region,
const int zone_id,
200 const char *tzd,
const int tzd_len,
204 #if !defined(SERVER_MODE) 207 extern TZ_REGION *tz_get_server_tz_region_session (
void);
209 #if !defined (CS_MODE) 219 #if !defined(SERVER_MODE) 223 extern int check_timezone_compat (
const char *client_checksum,
const char *server_checksum,
const char *client_text,
224 const char *server_text);
void tz_id_to_region(const TZ_ID *tz_id, TZ_REGION *tz_region)
const TZ_ID * tz_get_utc_tz_id(void)
int tz_full_timezones_start_scan(THREAD_ENTRY *thread_p, int show_type, DB_VALUE **arg_values, int arg_cnt, void **ptr)
int tz_resolve_os_timezone(char *timezone, int buf_size)
void tz_timestamp_decode_sec(int timestamp, int *yearp, int *monthsp, int *dayp, int *hoursp, int *minutesp, int *secondsp)
int tz_check_session_has_geographic_tz(void)
int tz_conv_tz_datetime_w_zone_name(const DB_DATETIME *src_dt, const char *source_zone, int len_source, const char *dest_zone, int len_dest, DB_DATETIME *dest_dt)
int tz_create_timestamptz_from_zoneid_and_tzd(const DB_DATE *date, const DB_TIME *time, TZ_REGION *default_tz_region, const int zone_id, const char *tzd, const int tzd_len, DB_TIMESTAMPTZ *timestamp_tz)
int tz_datetimeltz_to_local(const DB_DATETIME *dt_ltz, DB_DATETIME *dt_local)
const TZ_DATA * tz_get_new_timezone_data(void)
void tz_set_tz_region_system(const TZ_REGION *tz_region)
int tz_conv_tz_time_w_zone_name(const DB_TIME *time_source, const char *source_zone, int len_source, const char *dest_zone, int len_dest, DB_TIME *time_dest)
int tz_get_ds_change_julian_date_diff(const int src_julian_date, const TZ_DS_RULE *ds_rule, const int year, int *ds_rule_julian_date, full_date_t *date_diff)
int tz_get_first_weekday_around_date(const int year, const int month, const int weekday, const int after_day, const bool before)
void tz_get_session_tz_region(TZ_REGION *tz_region)
int tz_create_session_tzid_for_datetime(const DB_DATETIME *src_dt, bool src_is_utc, TZ_ID *tz_id)
void db_date_locale_init(void)
int tz_create_datetimetz_from_offset(const DB_DATETIME *dt, const int tzh, const int tzm, DB_DATETIMETZ *dt_tz)
int tz_datetimetz_fix_zone(const DB_DATETIMETZ *src_dt_tz, DB_DATETIMETZ *dest_dt_tz)
DB_BIGINT tz_timestamp_encode_leap_sec_adj(const int year_century, const int year, const int mon, const int day)
int tz_create_datetimetz(const DB_DATETIME *dt, const char *tz_str, const int tz_size, const TZ_REGION *default_tz_region, DB_DATETIMETZ *dt_tz, const char **end_tz_str)
int tz_create_datetimetz_from_utc(const DB_DATETIME *src_dt, const TZ_REGION *dest_region, DB_DATETIMETZ *dest_dt_tz)
void tz_get_system_tz_region(TZ_REGION *tz_region)
int tz_load_with_library_path(TZ_DATA *tzd, const char *timezone_library_path)
int tz_str_read_time(const char *str, const char *str_end, bool need_minutes, bool allow_sec60, int *hour, int *min, int *sec, const char **str_next)
int tz_create_datetimetz_from_parts(const int m, const int d, const int y, const int h, const int mi, const int s, const int ms, const TZ_ID *tz_id, DB_DATETIMETZ *dt_tz)
int tz_get_timezone_offset(const char *tz_str, int tz_size, char *result, DB_DATETIME *utc_datetime)
int tz_create_session_tzid_for_timestamp(const DB_UTIME *src_ts, TZ_ID *tz_id)
int tz_get_best_match_zone(const char *name, int *size)
void tz_set_new_timezone_data(const TZ_DATA *data)
int tz_get_offset_in_mins()
const char * tz_get_system_timezone(void)
void tz_set_data(const TZ_DATA *data)
int tz_id_to_str(const TZ_ID *tz_id, char *tz_str, const int tz_str_size)
TZ_REGION * tz_get_client_tz_region_session(void)
int tz_create_timestamptz(const DB_DATE *date, const DB_TIME *time, const char *tz_str, const int tz_size, const TZ_REGION *default_tz_region, DB_TIMESTAMPTZ *ts_tz, const char **end_tz_str)
int tz_create_timestamptz_from_offset(const DB_DATE *date, const DB_TIME *time, const int tzh, const int tzm, DB_TIMESTAMPTZ *timestamp_tz)
int tz_create_datetimetz_from_ses(const DB_DATETIME *dt, DB_DATETIMETZ *dt_tz)
int tz_str_to_region(const char *tz_str, const int tz_str_size, TZ_REGION *tz_region)
int tz_explain_tz_id(const TZ_ID *tz_id, char *tzr, const int tzr_size, char *tzdst, const int tzdst_size, int *tzh, int *tzm)
int tz_create_session_tzid_for_time(const DB_TIME *src_time, bool src_is_utc, TZ_ID *tz_id)
int conv_tz(void *, const void *, DB_TYPE)
void tz_tzid_convert_region_to_offset(TZ_ID *tz_id)
int tz_conv_tz_datetime_w_region(const DB_DATETIME *src_dt, const TZ_REGION *src_tz_region, const TZ_REGION *dest_tz_region, DB_DATETIME *dest_dt, TZ_ID *src_tz_id_out, TZ_ID *dest_tz_id_out)
const char * tz_get_session_local_timezone(void)
int tz_create_datetimetz_from_zoneid_and_tzd(const DB_DATETIME *dt, TZ_REGION *default_tz_region, const int zone_id, const char *tzd, const int tzd_len, bool is_time_tz, DB_DATETIMETZ *dt_tz)
int tz_timestamptz_fix_zone(const DB_TIMESTAMPTZ *src_ts_tz, DB_TIMESTAMPTZ *dest_ts_tz)
int tz_timezones_start_scan(THREAD_ENTRY *thread_p, int show_type, DB_VALUE **arg_values, int arg_cnt, void **ptr)
int tz_str_read_number(const char *str, const char *str_end, const bool strict, const bool read_sign, int *val, const char **str_next)
const TZ_DATA * tz_get_data(void)
int tz_str_to_seconds(const char *str, const char *str_end, int *sec, const char **str_next, const bool is_offset)
int tz_utc_datetimetz_to_local(const DB_DATETIME *dt_utc, const TZ_ID *tz_id, DB_DATETIME *dt_local)
const TZ_REGION * tz_get_utc_tz_region(void)
int tz_check_geographic_tz(const TZ_ID *tz_id)
int check_timezone_compat(const char *client_checksum, const char *server_checksum, const char *client_text, const char *server_text)
void tz_timestamp_decode_no_leap_sec(int timestamp, int *yearp, int *monthsp, int *dayp, int *hoursp, int *minutesp, int *secondsp)
int put_timezone_checksum(char *checksum)