CUBRID Engine  latest
db_date.c File Reference
#include <stdio.h>
#include <math.h>
#include <time.h>
#include "system.h"
#include "tz_support.h"
#include "db_date.h"
#include <assert.h>
#include "error_manager.h"
#include "chartype.h"
#include "numeric_opfunc.h"
#include "object_representation.h"
#include "dbtype.h"
Include dependency graph for db_date.c:

Go to the source code of this file.

Classes

struct  ampm_buf
 

Macros

#define IGREG1   (15 + 31L * (10 + 12L * 1582))
 
#define IGREG2   2299161 /* 10/15/1582 */
 
#define IGREG_SPECIAL   0 /* 01/01/-4713 DATE || 01/01/1970 00:00:00 TIMESTAMP */
 
#define FLOOR(d1)   (int) (d1 + 4000000.0) - 4000000
 
#define YBIAS   1900
 
#define MMDDYYYY   0
 
#define YYYYMMDD   1
 
#define DATETIME_FIELD_LIMIT   1000000
 

Typedefs

typedef struct ampm_buf AMPM_BUF
 

Functions

static void fill_local_ampm_str (char str[10], bool am)
 
static void decode_time (int timeval, int *hourp, int *minutep, int *secondp)
 
static int encode_time (int hour, int minute, int second)
 
static void decode_mtime (int mtimeval, int *hourp, int *minutep, int *secondp, int *millisecondp)
 
static unsigned int encode_mtime (int hour, int minute, int second, int millisecond)
 
static int init_tm (struct tm *)
 
static int get_current_year (void)
 
static const char * parse_date (const char *buf, int buf_len, DB_DATE *date)
 
static const char * parse_time (const char *buf, int buf_len, DB_TIME *mtime)
 
static const char * parse_mtime (const char *buf, int buf_len, unsigned int *mtime, bool *is_msec, bool *is_explicit)
 
static const char * parse_for_timestamp (const char *buf, int buf_len, DB_DATE *date, DB_TIME *time, bool allow_msec)
 
static const char * parse_datetime (const char *buf, int buf_len, DB_DATETIME *datetime)
 
static char constparse_date_separated (char const *str, char const *strend, DB_DATE *date, char const **syntax_check, int *year_digits, char *sep_ch)
 
static char constparse_mtime_separated (char const *str, char const *strend, unsigned int *mtime, char const **syntax_check, int *time_parts, char *sep_ch, bool *has_explicit_msec, bool is_datetime)
 
static char constparse_explicit_mtime_separated (char const *str, char const *strend, unsigned int *mtime, char const **syntax_check, bool *has_explicit_msec)
 
static char constparse_explicit_mtime_compact (char const *str, char const *strend, unsigned int *mtime)
 
static char constparse_timestamp_compact (char const *str, char const *strend, DB_DATE *date, unsigned int *mtime, bool *has_explicit_time, bool *has_explicit_msec)
 
static char constparse_timedate_separated (char const *str, char const *strend, DB_DATE *date, unsigned int *mtime, char const **syntax_check, bool *has_explicit_msec)
 
static int get_end_of_week_one_of_year (int year, int mode)
 
static bool is_local_am_str (const char *p, const char *p_end)
 
static bool is_local_pm_str (const char *p, const char *p_end)
 
static int db_timestamp_encode_w_reg (const DB_DATE *date, const DB_TIME *timeval, const TZ_REGION *tz_region, DB_TIMESTAMP *utime, TZ_ID *dest_tz_id)
 
int julian_encode (int m, int d, int y)
 
int day_of_week (int jul_day)
 
void julian_decode (int jul, int *monthp, int *dayp, int *yearp, int *weekp)
 
int db_date_encode (DB_DATE *date, int month, int day, int year)
 
int db_date_weekday (DB_DATE *date)
 
void db_date_decode (const DB_DATE *date, int *monthp, int *dayp, int *yearp)
 
int db_time_encode (DB_TIME *timeval, int hour, int minute, int second)
 
void db_time_decode (DB_TIME *timeval, int *hourp, int *minutep, int *secondp)
 
static int tm_encode (struct tm *c_time_struct, time_t *retval, DB_DATE *date, DB_TIME *timeval)
 
int db_tm_encode (struct tm *c_time_struct, DB_DATE *date, DB_TIME *timeval)
 
time_t db_mktime (DB_DATE *date, DB_TIME *timeval)
 
int db_timestamp_encode (DB_TIMESTAMP *utime, DB_DATE *date, DB_TIME *timeval)
 
int db_timestamp_encode_ses (const DB_DATE *date, const DB_TIME *timeval, DB_TIMESTAMP *utime, TZ_ID *dest_tz_id)
 
int db_timestamp_encode_sys (const DB_DATE *date, const DB_TIME *timeval, DB_TIMESTAMP *utime, TZ_ID *dest_tz_id)
 
int db_timestamp_encode_utc (const DB_DATE *date, const DB_TIME *timeval, DB_TIMESTAMP *utime)
 
int db_timestamp_decode_ses (const DB_TIMESTAMP *utime, DB_DATE *date, DB_TIME *timeval)
 
void db_timestamp_decode_utc (const DB_TIMESTAMP *utime, DB_DATE *date, DB_TIME *timeval)
 
int db_timestamp_decode_w_reg (const DB_TIMESTAMP *utime, const TZ_REGION *tz_region, DB_DATE *date, DB_TIME *timeval)
 
int db_timestamp_decode_w_tz_id (const DB_TIMESTAMP *utime, const TZ_ID *tz_id, DB_DATE *date, DB_TIME *timeval)
 
int db_strftime (char *s, int smax, const char *fmt, DB_DATE *date, DB_TIME *timeval)
 
void db_localtime (time_t *epoch_time, DB_DATE *date, DB_TIME *timeval)
 
void db_localdatetime (time_t *epoch_time, DB_DATETIME *datetime)
 
void db_localdatetime_msec (time_t *epoch_time, int millisecond, DB_DATETIME *datetime)
 
bool db_string_check_explicit_time (const char *str, int str_len)
 
void db_date_locale_init (void)
 
int db_date_parse_time (char const *str, int str_len, DB_TIME *time, int *millisecond)
 
int db_date_parse_datetime_parts (char const *str, int str_len, DB_DATETIME *datetime, bool *has_explicit_time, bool *has_explicit_msec, bool *fits_as_timestamp, char const **endp)
 
int db_date_parse_datetime (char const *str, int str_len, DB_DATETIME *datetime)
 
int db_date_parse_timestamp (char const *str, int str_len, DB_TIMESTAMP *utime)
 
int db_date_parse_date (char const *str, int str_len, DB_DATE *date)
 
bool db_string_check_explicit_date (const char *str, int str_len)
 
int db_string_to_date_ex (const char *str, int str_len, DB_DATE *date)
 
int db_string_to_date (const char *str, DB_DATE *date)
 
int db_string_to_time_ex (const char *str, int str_len, DB_TIME *time)
 
int db_string_to_time (const char *str, DB_TIME *time)
 
int db_string_to_timestamp_ex (const char *str, int str_len, DB_TIMESTAMP *utime)
 
int db_string_to_timestamp (const char *str, DB_TIMESTAMP *utime)
 
int db_string_to_timestamptz_ex (const char *str, int str_len, DB_TIMESTAMPTZ *ts_tz, bool *has_zone, bool is_cast)
 
int db_string_to_timestamptz (const char *str, DB_TIMESTAMPTZ *ts_tz, bool *has_zone)
 
int db_string_to_timestampltz_ex (const char *str, int str_len, DB_TIMESTAMP *ts)
 
int db_string_to_timestampltz (const char *str, DB_TIMESTAMP *ts)
 
int db_date_to_string (char *buf, int bufsize, DB_DATE *date)
 
int db_time_to_string (char *buf, int bufsize, DB_TIME *time)
 
int db_timestamp_to_string (char *buf, int bufsize, DB_TIMESTAMP *utime)
 
int db_timestamptz_to_string (char *buf, int bufsize, DB_TIMESTAMP *utime, const TZ_ID *tz_id)
 
int db_timestampltz_to_string (char *buf, int bufsize, DB_TIMESTAMP *utime)
 
int db_datetime_to_string (char *buf, int bufsize, DB_DATETIME *datetime)
 
int db_datetimetz_to_string (char *buf, int bufsize, DB_DATETIME *dt, const TZ_ID *tz_id)
 
int db_datetimeltz_to_string (char *buf, int bufsize, DB_DATETIME *dt)
 
int db_datetime_to_string2 (char *buf, int bufsize, DB_DATETIME *datetime)
 
int db_string_to_datetime_ex (const char *str, int str_len, DB_DATETIME *datetime)
 
int db_string_to_datetime (const char *str, DB_DATETIME *datetime)
 
int db_string_to_datetimetz_ex (const char *str, int str_len, DB_DATETIMETZ *dt_tz, bool *has_zone)
 
int db_string_to_datetimetz (const char *str, DB_DATETIMETZ *dt_tz, bool *has_zone)
 
int db_string_to_datetimeltz_ex (const char *str, int str_len, DB_DATETIME *datetime)
 
int db_string_to_datetimeltz (const char *str, DB_DATETIME *datetime)
 
int db_datetime_decode (const DB_DATETIME *datetime, int *month, int *day, int *year, int *hour, int *minute, int *second, int *millisecond)
 
int db_datetime_encode (DB_DATETIME *datetime, int month, int day, int year, int hour, int minute, int second, int millisecond)
 
int db_subtract_int_from_datetime (DB_DATETIME *dt1, DB_BIGINT bi2, DB_DATETIME *result_datetime)
 
int db_add_int_to_datetime (DB_DATETIME *datetime, DB_BIGINT bi2, DB_DATETIME *result_datetime)
 
int db_get_day_of_year (int year, int month, int day)
 
int db_get_day_of_week (int year, int month, int day)
 
int db_get_week_of_year (int year, int month, int day, int mode)
 
int db_check_time_date_format (const char *format_s)
 
int db_add_weeks_and_days_to_date (int *day, int *month, int *year, int weeks, int day_week)
 

Variables

static char local_am_str [10] = "am"
 
static char local_pm_str [10] = "pm"
 
static int local_am_strlen = 2
 
static int local_pm_strlen = 2
 

Macro Definition Documentation

#define DATETIME_FIELD_LIMIT   1000000
#define FLOOR (   d1)    (int) (d1 + 4000000.0) - 4000000

Definition at line 54 of file db_date.c.

Referenced by julian_encode().

#define IGREG1   (15 + 31L * (10 + 12L * 1582))

Definition at line 48 of file db_date.c.

Referenced by julian_encode().

#define IGREG2   2299161 /* 10/15/1582 */

Definition at line 50 of file db_date.c.

Referenced by julian_decode().

#define MMDDYYYY   0

Definition at line 58 of file db_date.c.

Referenced by parse_date().

#define YBIAS   1900

Definition at line 56 of file db_date.c.

Referenced by get_current_year().

#define YYYYMMDD   1

Definition at line 59 of file db_date.c.

Referenced by parse_date().

Typedef Documentation

typedef struct ampm_buf AMPM_BUF

Function Documentation

int day_of_week ( int  jul_day)

Definition at line 176 of file db_date.c.

References IGREG_SPECIAL.

Referenced by db_date_weekday(), db_get_date_weekday(), get_date_weekday(), get_day(), round_date(), and truncate_date().

Here is the caller graph for this function:

int db_add_weeks_and_days_to_date ( int *  day,
int *  month,
int *  year,
int  weeks,
int  day_week 
)

Definition at line 5009 of file db_date.c.

References ER_FAILED, i, IS_LEAP_YEAR, NO_ERROR, and NULL.

Referenced by db_str_to_date().

Here is the caller graph for this function:

int db_check_time_date_format ( const char *  format_s)

Definition at line 4914 of file db_date.c.

References DATE_SPECIFIER, DATETIME_SPECIFIER, DATETIMETZ_SPECIFIER, i, ampm_buf::len, strlen, and TIME_SPECIFIER.

Referenced by db_str_to_date(), and pt_eval_expr_type().

Here is the caller graph for this function:

void db_date_locale_init ( void  )

Definition at line 1531 of file db_date.c.

References fill_local_ampm_str(), local_am_str, local_am_strlen, local_pm_str, local_pm_strlen, and strlen.

Referenced by set_current_locale().

Here is the caller graph for this function:

int db_date_parse_date ( char const str,
int  str_len,
DB_DATE date 
)

Definition at line 3481 of file db_date.c.

References ARG_FILE_LINE, db_datetime::date, db_date_parse_datetime(), er_clear(), ER_DATE_CONVERSION, ER_ERROR_SEVERITY, er_set(), err, and NO_ERROR.

Referenced by tp_atodate().

Here is the caller graph for this function:

int db_date_parse_datetime ( char const str,
int  str_len,
DB_DATETIME datetime 
)

Definition at line 3423 of file db_date.c.

References db_date_parse_datetime_parts(), and NULL.

Referenced by db_date_parse_date(), db_date_parse_timestamp(), and tp_atoudatetime().

Here is the caller graph for this function:

int db_date_parse_datetime_parts ( char const str,
int  str_len,
DB_DATETIME datetime,
bool has_explicit_time,
bool has_explicit_msec,
bool fits_as_timestamp,
char const **  endp 
)
int db_date_parse_time ( char const str,
int  str_len,
DB_TIME time,
int *  millisecond 
)
int db_date_parse_timestamp ( char const str,
int  str_len,
DB_TIMESTAMP utime 
)
int db_date_weekday ( DB_DATE date)

Definition at line 321 of file db_date.c.

References day_of_week().

Referenced by date_as_string(), db_datetime_string(), db_string_date(), db_timestamp_string(), and fmt_date_value().

Here is the caller graph for this function:

int db_datetime_to_string2 ( char *  buf,
int  bufsize,
DB_DATETIME datetime 
)

Definition at line 4375 of file db_date.c.

References db_datetime_decode(), and NULL.

Referenced by la_log_page_check().

Here is the caller graph for this function:

int db_datetimeltz_to_string ( char *  buf,
int  bufsize,
DB_DATETIME dt 
)
int db_get_day_of_week ( int  year,
int  month,
int  day 
)
int db_get_day_of_year ( int  year,
int  month,
int  day 
)

Definition at line 4697 of file db_date.c.

References i, and IS_LEAP_YEAR.

Referenced by db_get_date_dayofyear(), db_get_date_totaldays(), db_get_week_of_year(), and db_time_diff().

Here is the caller graph for this function:

int db_get_week_of_year ( int  year,
int  month,
int  day,
int  mode 
)

Definition at line 4854 of file db_date.c.

References assert, db_get_day_of_year(), get_end_of_week_one_of_year(), and IS_LEAP_YEAR.

Referenced by db_get_date_week().

Here is the caller graph for this function:

void db_localdatetime_msec ( time_t *  epoch_time,
int  millisecond,
DB_DATETIME datetime 
)

Definition at line 1044 of file db_date.c.

References db_datetime_encode(), and NULL.

Referenced by db_localdatetime(), logtb_descriptors_start_scan(), and showstmt_array_end_scan().

Here is the caller graph for this function:

void db_localtime ( time_t *  epoch_time,
DB_DATE date,
DB_TIME timeval 
)

Definition at line 1000 of file db_date.c.

References encode_time(), julian_encode(), and NULL.

time_t db_mktime ( DB_DATE date,
DB_TIME timeval 
)

Definition at line 557 of file db_date.c.

References NO_ERROR, and tm_encode().

Referenced by catcls_get_apply_info_log_record_time().

Here is the caller graph for this function:

int db_strftime ( char *  s,
int  smax,
const char *  fmt,
DB_DATE date,
DB_TIME timeval 
)

Definition at line 973 of file db_date.c.

References db_tm_encode(), and NO_ERROR.

Referenced by double_to_string(), and pt_xasl_data_type_to_domain().

Here is the caller graph for this function:

bool db_string_check_explicit_date ( const char *  str,
int  str_len 
)

Definition at line 3629 of file db_date.c.

References char_isspace(), NULL, and parse_date().

Referenced by pt_check_and_coerce_to_date().

Here is the caller graph for this function:

bool db_string_check_explicit_time ( const char *  str,
int  str_len 
)

Definition at line 1331 of file db_date.c.

References NULL, and parse_mtime().

Referenced by pt_check_and_coerce_to_time().

Here is the caller graph for this function:

int db_string_to_date ( const char *  str,
DB_DATE date 
)

Definition at line 3693 of file db_date.c.

References db_string_to_date_ex(), and strlen.

Referenced by db_string_value(), jsp_unpack_date_value(), ldr_check_date_time_conversion(), ldr_date_elem(), pt_db_value_initialize(), and cubload::to_db_date().

Here is the caller graph for this function:

int db_string_to_date_ex ( const char *  str,
int  str_len,
DB_DATE date 
)

Definition at line 3661 of file db_date.c.

References ARG_FILE_LINE, char_isspace(), ER_DATE_CONVERSION, er_set(), ER_WARNING_SEVERITY, NO_ERROR, NULL, p, and parse_date().

Referenced by db_string_extract_dbval(), db_string_to_date(), and db_to_date().

Here is the caller graph for this function:

int db_string_to_datetime ( const char *  str,
DB_DATETIME datetime 
)
int db_string_to_datetime_ex ( const char *  str,
int  str_len,
DB_DATETIME datetime 
)

Definition at line 4414 of file db_date.c.

References ARG_FILE_LINE, char_isspace(), ER_DATE_CONVERSION, er_set(), ER_WARNING_SEVERITY, NO_ERROR, NULL, p, and parse_datetime().

Referenced by db_string_extract_dbval(), db_string_to_datetime(), and db_to_datetime().

Here is the caller graph for this function:

int db_string_to_datetimeltz ( const char *  str,
DB_DATETIME datetime 
)

Definition at line 4555 of file db_date.c.

References db_string_to_datetimeltz_ex(), and strlen.

Referenced by ldr_check_date_time_conversion(), ldr_datetimeltz_elem(), pt_db_value_initialize(), and cubload::to_db_datetimeltz().

Here is the caller graph for this function:

int db_string_to_datetimeltz_ex ( const char *  str,
int  str_len,
DB_DATETIME datetime 
)

Definition at line 4533 of file db_date.c.

References db_datetimetz::datetime, db_string_to_datetimetz_ex(), error(), and NO_ERROR.

Referenced by db_string_to_datetimeltz().

Here is the caller graph for this function:

int db_string_to_datetimetz ( const char *  str,
DB_DATETIMETZ dt_tz,
bool has_zone 
)

Definition at line 4520 of file db_date.c.

References db_string_to_datetimetz_ex(), and strlen.

Referenced by ldr_check_date_time_conversion(), ldr_datetimetz_elem(), pt_db_value_initialize(), and cubload::to_db_datetimetz().

Here is the caller graph for this function:

int db_string_to_time ( const char *  str,
DB_TIME time 
)

Definition at line 3739 of file db_date.c.

References db_string_to_time_ex(), and strlen.

Referenced by db_string_value(), jsp_unpack_time_value(), ldr_check_date_time_conversion(), ldr_time_elem(), pt_db_value_initialize(), and cubload::to_db_time().

Here is the caller graph for this function:

int db_string_to_time_ex ( const char *  str,
int  str_len,
DB_TIME time 
)
int db_string_to_timestamp ( const char *  str,
DB_TIMESTAMP utime 
)

Definition at line 3802 of file db_date.c.

References db_string_to_timestamp_ex(), and strlen.

Referenced by db_string_value(), jsp_unpack_timestamp_value(), ldr_check_date_time_conversion(), ldr_timestamp_elem(), and cubload::to_db_timestamp().

Here is the caller graph for this function:

int db_string_to_timestamp_ex ( const char *  str,
int  str_len,
DB_TIMESTAMP utime 
)
int db_string_to_timestampltz ( const char *  str,
DB_TIMESTAMP ts 
)

Definition at line 3936 of file db_date.c.

References db_string_to_timestampltz_ex(), and strlen.

Referenced by ldr_check_date_time_conversion(), ldr_timestampltz_elem(), pt_db_value_initialize(), and cubload::to_db_timestampltz().

Here is the caller graph for this function:

int db_string_to_timestampltz_ex ( const char *  str,
int  str_len,
DB_TIMESTAMP ts 
)

Definition at line 3908 of file db_date.c.

References ARG_FILE_LINE, db_string_to_timestamptz_ex(), ER_DATE_CONVERSION, er_set(), ER_WARNING_SEVERITY, error(), NO_ERROR, and db_timestamptz::timestamp.

Referenced by db_string_to_timestampltz().

Here is the caller graph for this function:

int db_string_to_timestamptz ( const char *  str,
DB_TIMESTAMPTZ ts_tz,
bool has_zone 
)

Definition at line 3894 of file db_date.c.

References db_string_to_timestamptz_ex(), and strlen.

Referenced by ldr_check_date_time_conversion(), ldr_timestamptz_elem(), pt_db_value_initialize(), and cubload::to_db_timestamptz().

Here is the caller graph for this function:

int db_string_to_timestamptz_ex ( const char *  str,
int  str_len,
DB_TIMESTAMPTZ ts_tz,
bool has_zone,
bool  is_cast 
)
int db_time_encode ( DB_TIME timeval,
int  hour,
int  minute,
int  second 
)
int db_time_to_string ( char *  buf,
int  bufsize,
DB_TIME time 
)
int db_timestamp_decode_w_reg ( const DB_TIMESTAMP utime,
const TZ_REGION tz_region,
DB_DATE date,
DB_TIME timeval 
)
int db_timestamp_encode ( DB_TIMESTAMP utime,
DB_DATE date,
DB_TIME timeval 
)

Definition at line 579 of file db_date.c.

References db_timestamp_encode_ses(), and NULL.

Referenced by db_unix_timestamp().

Here is the caller graph for this function:

int db_timestamp_encode_sys ( const DB_DATE date,
const DB_TIME timeval,
DB_TIMESTAMP utime,
TZ_ID dest_tz_id 
)

Definition at line 617 of file db_date.c.

References db_timestamp_encode_w_reg(), and tz_get_system_tz_region().

Referenced by do_evaluate_default_expr(), fetch_peek_arith(), pt_evaluate_db_value_expr(), and qexec_execute_insert().

Here is the caller graph for this function:

static int db_timestamp_encode_w_reg ( const DB_DATE date,
const DB_TIME timeval,
const TZ_REGION tz_region,
DB_TIMESTAMP utime,
TZ_ID dest_tz_id 
)
static
int db_timestamp_to_string ( char *  buf,
int  bufsize,
DB_TIMESTAMP utime 
)

Definition at line 4054 of file db_date.c.

References db_date_to_string(), db_time_to_string(), and db_timestamp_decode_ses().

Referenced by date_to_char(), db_value_get(), fprint_special_strings(), tp_value_cast_internal(), and valcnv_convert_data_to_string().

Here is the caller graph for this function:

int db_timestampltz_to_string ( char *  buf,
int  bufsize,
DB_TIMESTAMP utime 
)
int db_timestamptz_to_string ( char *  buf,
int  bufsize,
DB_TIMESTAMP utime,
const TZ_ID tz_id 
)
int db_tm_encode ( struct tm *  c_time_struct,
DB_DATE date,
DB_TIME timeval 
)

Definition at line 536 of file db_date.c.

References tm_encode().

Referenced by db_set_base_server_time(), and db_strftime().

Here is the caller graph for this function:

static void decode_mtime ( int  mtimeval,
int *  hourp,
int *  minutep,
int *  secondp,
int *  millisecondp 
)
static

Definition at line 4189 of file db_date.c.

References NULL.

Referenced by db_datetime_decode().

Here is the caller graph for this function:

static void decode_time ( int  timeval,
int *  hourp,
int *  minutep,
int *  secondp 
)
static

Definition at line 401 of file db_date.c.

References NULL.

Referenced by db_time_decode(), db_timestamp_encode_utc(), and tm_encode().

Here is the caller graph for this function:

static unsigned int encode_mtime ( int  hour,
int  minute,
int  second,
int  millisecond 
)
static

Definition at line 4173 of file db_date.c.

Referenced by db_datetime_encode(), parse_explicit_mtime_compact(), parse_explicit_mtime_separated(), parse_mtime(), parse_mtime_separated(), and parse_timestamp_compact().

Here is the caller graph for this function:

static int encode_time ( int  hour,
int  minute,
int  second 
)
static

Definition at line 355 of file db_date.c.

Referenced by db_localtime(), and db_timestamp_decode_utc().

Here is the caller graph for this function:

static void fill_local_ampm_str ( char  str[10],
bool  am 
)
static

Definition at line 1492 of file db_date.c.

References init_tm().

Referenced by db_date_locale_init().

Here is the caller graph for this function:

static int get_current_year ( void  )
static

Definition at line 1100 of file db_date.c.

References init_tm(), and YBIAS.

Referenced by parse_date(), parse_date_separated(), parse_explicit_mtime_compact(), and parse_timestamp_compact().

Here is the caller graph for this function:

static int get_end_of_week_one_of_year ( int  year,
int  mode 
)
static

Definition at line 4758 of file db_date.c.

References assert, and db_get_day_of_week().

Referenced by db_get_week_of_year().

Here is the caller graph for this function:

static int init_tm ( struct tm *  tm)
static

Definition at line 1073 of file db_date.c.

References NULL.

Referenced by fill_local_ampm_str(), get_current_year(), and tm_encode().

Here is the caller graph for this function:

static bool is_local_am_str ( const char *  p,
const char *  p_end 
)
static

Definition at line 1547 of file db_date.c.

References intl_mbs_ncasecmp(), local_am_str, and local_am_strlen.

Referenced by parse_explicit_mtime_compact(), parse_explicit_mtime_separated(), parse_mtime(), parse_mtime_separated(), and parse_timestamp_compact().

Here is the caller graph for this function:

static bool is_local_pm_str ( const char *  p,
const char *  p_end 
)
static

Definition at line 1559 of file db_date.c.

References intl_mbs_ncasecmp(), local_pm_str, and local_pm_strlen.

Referenced by parse_explicit_mtime_compact(), parse_explicit_mtime_separated(), parse_mtime(), parse_mtime_separated(), and parse_timestamp_compact().

Here is the caller graph for this function:

void julian_decode ( int  jul,
int *  monthp,
int *  dayp,
int *  yearp,
int *  weekp 
)
static const char * parse_date ( const char *  buf,
int  buf_len,
DB_DATE date 
)
static
static char const * parse_date_separated ( char const str,
char const strend,
DB_DATE date,
char const **  syntax_check,
int *  year_digits,
char *  sep_ch 
)
static
static const char * parse_datetime ( const char *  buf,
int  buf_len,
DB_DATETIME datetime 
)
static

Definition at line 3577 of file db_date.c.

References CAST_BUFLEN, db_datetime::date, IGREG_SPECIAL, NULL, p, parse_date(), parse_mtime(), and db_datetime::time.

Referenced by db_string_to_datetime_ex(), and db_string_to_datetimetz_ex().

Here is the caller graph for this function:

static char const * parse_explicit_mtime_compact ( char const str,
char const strend,
unsigned int *  mtime 
)
static
static char const * parse_explicit_mtime_separated ( char const str,
char const strend,
unsigned int *  mtime,
char const **  syntax_check,
bool has_explicit_msec 
)
static
static const char * parse_for_timestamp ( const char *  buf,
int  buf_len,
DB_DATE date,
DB_TIME time,
bool  allow_msec 
)
static

Definition at line 3512 of file db_date.c.

References CAST_BUFLEN, IGREG_SPECIAL, NULL, p, parse_date(), parse_mtime(), and parse_time().

Referenced by db_string_to_timestamp_ex(), and db_string_to_timestamptz_ex().

Here is the caller graph for this function:

static const char * parse_mtime ( const char *  buf,
int  buf_len,
unsigned int *  mtime,
bool is_msec,
bool is_explicit 
)
static
static char const * parse_mtime_separated ( char const str,
char const strend,
unsigned int *  mtime,
char const **  syntax_check,
int *  time_parts,
char *  sep_ch,
bool has_explicit_msec,
bool  is_datetime 
)
static
static const char * parse_time ( const char *  buf,
int  buf_len,
DB_TIME mtime 
)
static

Definition at line 1303 of file db_date.c.

References NULL, p, and parse_mtime().

Referenced by db_string_to_time_ex(), and parse_for_timestamp().

Here is the caller graph for this function:

static char const * parse_timedate_separated ( char const str,
char const strend,
DB_DATE date,
unsigned int *  mtime,
char const **  syntax_check,
bool has_explicit_msec 
)
static
static char const * parse_timestamp_compact ( char const str,
char const strend,
DB_DATE date,
unsigned int *  mtime,
bool has_explicit_time,
bool has_explicit_msec 
)
static
static int tm_encode ( struct tm *  c_time_struct,
time_t *  retval,
DB_DATE date,
DB_TIME timeval 
)
static

Definition at line 458 of file db_date.c.

References ARG_FILE_LINE, decode_time(), ER_DATE_CONVERSION, er_set(), ER_WARNING_SEVERITY, init_tm(), julian_decode(), min, NO_ERROR, and NULL.

Referenced by db_mktime(), and db_tm_encode().

Here is the caller graph for this function:

Variable Documentation

char local_am_str[10] = "am"
static

Definition at line 71 of file db_date.c.

Referenced by db_date_locale_init(), and is_local_am_str().

char local_pm_str[10] = "pm"
static

Definition at line 71 of file db_date.c.

Referenced by db_date_locale_init(), and is_local_pm_str().