Skip to content

File tz_support.h

FileList > base > tz_support.h

Go to the source code of this file

  • #include "dbtype_def.h"
  • #include "thread_compat.hpp"
  • #include "timezone_lib_common.h"

Public Types

Type Name
typedef DB_BIGINT full_date_t
enum tz__support_8h_1a4caf8d8f829279fba122163d961608a4
enum tz__support_8h_1a96a58e29e8dbf2b5bdeb775cba46556e
enum tz__support_8h_1ab48899087cc647f0f791ed0c459adc53

Public Attributes

Type Name
bool tz_Compare_datetimetz_tz_id
bool tz_Compare_timestamptz_tz_id
bool tz_Is_backward_compatible_timezone

Public Functions

Type Name
int check_timezone_compat (const char * client_checksum, const char * server_checksum, const char * client_text, const char * server_text)
int conv_tz (void * p_out, const void * p_in, DB_TYPE type)
void db_date_locale_init (void)
int tz_check_geographic_tz (const TZ_ID * tz_id)
int tz_check_session_has_geographic_tz (void)
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)
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_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_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_offset (const DB_DATETIME * dt, const int tzh, const int tzm, DB_DATETIMETZ * dt_tz)
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_create_datetimetz_from_ses (const DB_DATETIME * dt, DB_DATETIMETZ * dt_tz)
int tz_create_datetimetz_from_utc (const DB_DATETIME * src_dt, const TZ_REGION * dest_region, DB_DATETIMETZ * dest_dt_tz)
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_create_session_tzid_for_datetime (const DB_DATETIME * src_dt, bool src_is_utc, TZ_ID * tz_id)
int tz_create_session_tzid_for_time (const DB_TIME * src_time, bool src_is_utc, TZ_ID * tz_id)
int tz_create_session_tzid_for_timestamp (const DB_UTIME * src_ts, TZ_ID * tz_id)
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_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)
int tz_datetimetz_fix_zone (const DB_DATETIMETZ * src_dt_tz, DB_DATETIMETZ * dest_dt_tz)
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_get_best_match_zone (const char * name, int * size)
const TZ_DATA * tz_get_data (void)
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)
const TZ_DATA * tz_get_new_timezone_data (void)
int tz_get_offset_in_mins ()
TZ_REGION * tz_get_server_tz_region_session (void)
const char * tz_get_session_local_timezone (void)
void tz_get_session_tz_region (TZ_REGION * tz_region)
const char * tz_get_system_timezone (void)
void tz_get_system_tz_region (TZ_REGION * tz_region)
int tz_get_timezone_offset (const char * tz_str, int tz_size, char * result, DB_DATETIME * utc_datetime)
const TZ_ID * tz_get_utc_tz_id (void)
const TZ_REGION * tz_get_utc_tz_region (void)
void tz_id_to_region (const TZ_ID * tz_id, TZ_REGION * tz_region)
int tz_id_to_str (const TZ_ID * tz_id, char * tz_str, const int tz_str_size)
int tz_load (void)
int tz_load_with_library_path (TZ_DATA * tzd, const char * timezone_library_path)
int tz_resolve_os_timezone (char * timezone, int buf_size)
void tz_set_data (const TZ_DATA * data)
void tz_set_new_timezone_data (const TZ_DATA * data)
void tz_set_tz_region_system (const TZ_REGION * tz_region)
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)
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_str_to_region (const char * tz_str, const int tz_str_size, TZ_REGION * tz_region)
int tz_str_to_seconds (const char * str, const char * str_end, int * sec, const char ** str_next, const bool is_offset)
void tz_timestamp_decode_no_leap_sec (int timestamp, int * yearp, int * monthsp, int * dayp, int * hoursp, int * minutesp, int * secondsp)
void tz_timestamp_decode_sec (int timestamp, int * yearp, int * monthsp, int * dayp, int * hoursp, int * minutesp, int * secondsp)
DB_BIGINT tz_timestamp_encode_leap_sec_adj (const int year_century, const int year, const int mon, const int day)
int tz_timestamptz_fix_zone (const DB_TIMESTAMPTZ * src_ts_tz, DB_TIMESTAMPTZ * dest_ts_tz)
void tz_tzid_convert_region_to_offset (TZ_ID * tz_id)
void tz_unload (void)
int tz_utc_datetimetz_to_local (const DB_DATETIME * dt_utc, const TZ_ID * tz_id, DB_DATETIME * dt_local)

Macros

Type Name
define DATE_DIFF_MATCH_SAFE_THRESHOLD_DAYS 2
define DATE_DIFF_MATCH_SAFE_THRESHOLD_SEC 172800ll
define DAYS_IN_MONTH (m) (31 - ((m) > 6 ? (m) - 7 : (m)) % 2)
define IS_EMPTY_STR (s) ((s) == [**NULL**](freelistheap_8h.md#define-null) \|\| \*(s) == '\0')
define IS_LEAP_YEAR (y) (((([**y**](broker__monitor_8c.md#function-timeout)) & 3) == 0) && (((([**y**](broker__monitor_8c.md#function-timeout)) % 25) != 0) \|\| ((([**y**](broker__monitor_8c.md#function-timeout)) & 15) == 0)))
define LIB_TZ_NAME "libcubrid\_timezones.so"
define MAX_LEN_OFFSET 10
define SHLIB_EXPORT_PREFIX ""
define TZLIB_SYMBOL_NAME_SIZE 64
define TZR_SIZE 100
define TZ_DS_ID_MAX 0xff
define TZ_DS_STRING_SIZE 10
define TZ_IS_UTC_TZ_REGION (r) ((r)->type == TZ\_REGION\_OFFSET && (r)->offset == 0)
define TZ_IS_ZONE_VALID_DECODE_INFO (tz_info) /* multi line expression */
define TZ_MAX_JULIAN_DATE 5373486
define TZ_MAX_YEAR 9999
define TZ_OFFSET_ID_MAX 0xff
define TZ_ZONE_ID_MAX 0x3ff
define ZONE_MAX 10000
define db_date_parse_utime [**db\_date\_parse\_timestamp**](db__date_8c.md#function-db_date_parse_timestamp)
define db_string_to_utime [**db\_string\_to\_timestamp**](db__date_8c.md#function-db_string_to_timestamp)
define db_utime_to_string [**db\_timestamp\_to\_string**](db__date_8c.md#function-db_timestamp_to_string)

Public Types Documentation

typedef full_date_t

typedef DB_BIGINT full_date_t;

enum tz__support_8h_1a4caf8d8f829279fba122163d961608a4

enum tz__support_8h_1a4caf8d8f829279fba122163d961608a4 {
    TIME_SPECIFIER = 1,
    DATE_SPECIFIER = 2,
    DATETIME_SPECIFIER = 3,
    REMOVED_TIMETZ_SPECIFIER = 4,
    DATETIMETZ_SPECIFIER = 5
};

enum tz__support_8h_1a96a58e29e8dbf2b5bdeb775cba46556e

enum tz__support_8h_1a96a58e29e8dbf2b5bdeb775cba46556e {
    TZ_MON_JAN = 0,
    TZ_MON_FEB = 1,
    TZ_MON_MAR = 2,
    TZ_MON_APR = 3,
    TZ_MON_MAY = 4,
    TZ_MON_JUN = 5,
    TZ_MON_JUL = 6,
    TZ_MON_AUG = 7,
    TZ_MON_SEP = 8,
    TZ_MON_OCT = 9,
    TZ_MON_NOV = 10,
    TZ_MON_DEC = 11,
    TZ_MON_COUNT = 12
};

enum tz__support_8h_1ab48899087cc647f0f791ed0c459adc53

enum tz__support_8h_1ab48899087cc647f0f791ed0c459adc53 {
    TZ_WEEK_DAY_SUN = 0,
    TZ_WEEK_DAY_MON = 1,
    TZ_WEEK_DAY_TUE = 2,
    TZ_WEEK_DAY_WED = 3,
    TZ_WEEK_DAY_THU = 4,
    TZ_WEEK_DAY_FRI = 5,
    TZ_WEEK_DAY_SAT = 6,
    TZ_WEEK_DAY_COUNT = 7
};

Public Attributes Documentation

variable tz_Compare_datetimetz_tz_id

bool tz_Compare_datetimetz_tz_id;

variable tz_Compare_timestamptz_tz_id

bool tz_Compare_timestamptz_tz_id;

variable tz_Is_backward_compatible_timezone

bool tz_Is_backward_compatible_timezone[];

Public Functions Documentation

function check_timezone_compat

int check_timezone_compat (
    const  char * client_checksum,
    const  char * server_checksum,
    const  char * client_text,
    const  char * server_text
) 

function conv_tz

int conv_tz (
    void * p_out,
    const  void * p_in,
    DB_TYPE type
) 

function db_date_locale_init

void db_date_locale_init (
    void
) 

function tz_check_geographic_tz

int tz_check_geographic_tz (
    const  TZ_ID * tz_id
) 

function tz_check_session_has_geographic_tz

int tz_check_session_has_geographic_tz (
    void
) 

function tz_conv_tz_datetime_w_region

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
) 

function tz_conv_tz_datetime_w_zone_name

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
) 

function tz_conv_tz_time_w_zone_name

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
) 

function tz_create_datetimetz

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
) 

function tz_create_datetimetz_from_offset

int tz_create_datetimetz_from_offset (
    const  DB_DATETIME * dt,
    const  int tzh,
    const  int tzm,
    DB_DATETIMETZ * dt_tz
) 

function tz_create_datetimetz_from_parts

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
) 

function tz_create_datetimetz_from_ses

int tz_create_datetimetz_from_ses (
    const  DB_DATETIME * dt,
    DB_DATETIMETZ * dt_tz
) 

function tz_create_datetimetz_from_utc

int tz_create_datetimetz_from_utc (
    const  DB_DATETIME * src_dt,
    const  TZ_REGION * dest_region,
    DB_DATETIMETZ * dest_dt_tz
) 

function tz_create_datetimetz_from_zoneid_and_tzd

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
) 

function tz_create_session_tzid_for_datetime

int tz_create_session_tzid_for_datetime (
    const  DB_DATETIME * src_dt,
    bool src_is_utc,
    TZ_ID * tz_id
) 

function tz_create_session_tzid_for_time

int tz_create_session_tzid_for_time (
    const  DB_TIME * src_time,
    bool src_is_utc,
    TZ_ID * tz_id
) 

function tz_create_session_tzid_for_timestamp

int tz_create_session_tzid_for_timestamp (
    const  DB_UTIME * src_ts,
    TZ_ID * tz_id
) 

function tz_create_timestamptz

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
) 

function tz_create_timestamptz_from_offset

int tz_create_timestamptz_from_offset (
    const  DB_DATE * date,
    const  DB_TIME * time,
    const  int tzh,
    const  int tzm,
    DB_TIMESTAMPTZ * timestamp_tz
) 

function tz_create_timestamptz_from_zoneid_and_tzd

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
) 

function tz_datetimeltz_to_local

int tz_datetimeltz_to_local (
    const  DB_DATETIME * dt_ltz,
    DB_DATETIME * dt_local
) 

function tz_datetimetz_fix_zone

int tz_datetimetz_fix_zone (
    const  DB_DATETIMETZ * src_dt_tz,
    DB_DATETIMETZ * dest_dt_tz
) 

function tz_explain_tz_id

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
) 

function tz_get_best_match_zone

int tz_get_best_match_zone (
    const  char * name,
    int * size
) 

function tz_get_data

const  TZ_DATA * tz_get_data (
    void
) 

function tz_get_ds_change_julian_date_diff

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
) 

function tz_get_first_weekday_around_date

int tz_get_first_weekday_around_date (
    const  int year,
    const  int month,
    const  int weekday,
    const  int after_day,
    const  bool before
) 

function tz_get_new_timezone_data

const  TZ_DATA * tz_get_new_timezone_data (
    void
) 

function tz_get_offset_in_mins

int tz_get_offset_in_mins () 

function tz_get_server_tz_region_session

TZ_REGION * tz_get_server_tz_region_session (
    void
) 

function tz_get_session_local_timezone

const  char * tz_get_session_local_timezone (
    void
) 

function tz_get_session_tz_region

void tz_get_session_tz_region (
    TZ_REGION * tz_region
) 

function tz_get_system_timezone

const  char * tz_get_system_timezone (
    void
) 

function tz_get_system_tz_region

void tz_get_system_tz_region (
    TZ_REGION * tz_region
) 

function tz_get_timezone_offset

int tz_get_timezone_offset (
    const  char * tz_str,
    int tz_size,
    char * result,
    DB_DATETIME * utc_datetime
) 

function tz_get_utc_tz_id

const  TZ_ID * tz_get_utc_tz_id (
    void
) 

function tz_get_utc_tz_region

const  TZ_REGION * tz_get_utc_tz_region (
    void
) 

function tz_id_to_region

void tz_id_to_region (
    const  TZ_ID * tz_id,
    TZ_REGION * tz_region
) 

function tz_id_to_str

int tz_id_to_str (
    const  TZ_ID * tz_id,
    char * tz_str,
    const  int tz_str_size
) 

function tz_load

int tz_load (
    void
) 

function tz_load_with_library_path

int tz_load_with_library_path (
    TZ_DATA * tzd,
    const  char * timezone_library_path
) 

function tz_resolve_os_timezone

int tz_resolve_os_timezone (
    char * timezone,
    int buf_size
) 

function tz_set_data

void tz_set_data (
    const  TZ_DATA * data
) 

function tz_set_new_timezone_data

void tz_set_new_timezone_data (
    const  TZ_DATA * data
) 

function tz_set_tz_region_system

void tz_set_tz_region_system (
    const  TZ_REGION * tz_region
) 

function tz_str_read_number

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
) 

function tz_str_read_time

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
) 

function tz_str_to_region

int tz_str_to_region (
    const  char * tz_str,
    const  int tz_str_size,
    TZ_REGION * tz_region
) 

function tz_str_to_seconds

int tz_str_to_seconds (
    const  char * str,
    const  char * str_end,
    int * sec,
    const  char ** str_next,
    const  bool is_offset
) 

function tz_timestamp_decode_no_leap_sec

void tz_timestamp_decode_no_leap_sec (
    int timestamp,
    int * yearp,
    int * monthsp,
    int * dayp,
    int * hoursp,
    int * minutesp,
    int * secondsp
) 

function tz_timestamp_decode_sec

void tz_timestamp_decode_sec (
    int timestamp,
    int * yearp,
    int * monthsp,
    int * dayp,
    int * hoursp,
    int * minutesp,
    int * secondsp
) 

function tz_timestamp_encode_leap_sec_adj

DB_BIGINT tz_timestamp_encode_leap_sec_adj (
    const  int year_century,
    const  int year,
    const  int mon,
    const  int day
) 

function tz_timestamptz_fix_zone

int tz_timestamptz_fix_zone (
    const  DB_TIMESTAMPTZ * src_ts_tz,
    DB_TIMESTAMPTZ * dest_ts_tz
) 

function tz_tzid_convert_region_to_offset

void tz_tzid_convert_region_to_offset (
    TZ_ID * tz_id
) 

function tz_unload

void tz_unload (
    void
) 

function tz_utc_datetimetz_to_local

int tz_utc_datetimetz_to_local (
    const  DB_DATETIME * dt_utc,
    const  TZ_ID * tz_id,
    DB_DATETIME * dt_local
) 

Macro Definition Documentation

define DATE_DIFF_MATCH_SAFE_THRESHOLD_DAYS

#define DATE_DIFF_MATCH_SAFE_THRESHOLD_DAYS `2`

define DATE_DIFF_MATCH_SAFE_THRESHOLD_SEC

#define DATE_DIFF_MATCH_SAFE_THRESHOLD_SEC `172800ll`

define DAYS_IN_MONTH

#define DAYS_IN_MONTH (
    m
) `(31 - ((m) > 6 ? (m) - 7 : (m)) % 2)`

define IS_EMPTY_STR

#define IS_EMPTY_STR (
    s
) `((s) == NULL || *(s) == '\0')`

define IS_LEAP_YEAR

#define IS_LEAP_YEAR (
    y
) `(((( y ) & 3) == 0) && (((( y ) % 25) != 0) || ((( y ) & 15) == 0)))`

define LIB_TZ_NAME

#define LIB_TZ_NAME `"libcubrid_timezones.so"`

define MAX_LEN_OFFSET

#define MAX_LEN_OFFSET `10`

define SHLIB_EXPORT_PREFIX

#define SHLIB_EXPORT_PREFIX `""`

define TZLIB_SYMBOL_NAME_SIZE

#define TZLIB_SYMBOL_NAME_SIZE `64`

define TZR_SIZE

#define TZR_SIZE `100`

define TZ_DS_ID_MAX

#define TZ_DS_ID_MAX `0xff`

define TZ_DS_STRING_SIZE

#define TZ_DS_STRING_SIZE `10`

define TZ_IS_UTC_TZ_REGION

#define TZ_IS_UTC_TZ_REGION (
    r
) `((r)->type == TZ_REGION_OFFSET && (r)->offset == 0)`

define TZ_IS_ZONE_VALID_DECODE_INFO

#define TZ_IS_ZONE_VALID_DECODE_INFO (
    tz_info
) `/* multi line expression */`

define TZ_MAX_JULIAN_DATE

#define TZ_MAX_JULIAN_DATE `5373486`

define TZ_MAX_YEAR

#define TZ_MAX_YEAR `9999`

define TZ_OFFSET_ID_MAX

#define TZ_OFFSET_ID_MAX `0xff`

define TZ_ZONE_ID_MAX

#define TZ_ZONE_ID_MAX `0x3ff`

define ZONE_MAX

#define ZONE_MAX `10000`

define db_date_parse_utime

#define db_date_parse_utime `db_date_parse_timestamp`

define db_string_to_utime

#define db_string_to_utime `db_string_to_timestamp`

define db_utime_to_string

#define db_utime_to_string `db_timestamp_to_string`


The documentation for this class was generated from the following file cubrid/src/base/tz_support.h