MySQL 9.1.0
Source Code Documentation
|
#include "sql/tztime.h"
#include <algorithm>
#include <assert.h>
#include <fcntl.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <time.h>
#include "lex_string.h"
#include "map_helpers.h"
#include "mutex_lock.h"
#include "my_alloc.h"
#include "my_base.h"
#include "my_compiler.h"
#include "my_dbug.h"
#include "my_dir.h"
#include "my_inttypes.h"
#include "my_io.h"
#include "my_macros.h"
#include "my_pointer_arithmetic.h"
#include "my_psi_config.h"
#include "my_sys.h"
#include "my_time.h"
#include "mysql/components/services/bits/mysql_mutex_bits.h"
#include "mysql/components/services/bits/psi_bits.h"
#include "mysql/components/services/bits/psi_memory_bits.h"
#include "mysql/components/services/bits/psi_mutex_bits.h"
#include "mysql/components/services/log_builtins.h"
#include "mysql/components/services/log_shared.h"
#include "mysql/my_loglevel.h"
#include "mysql/psi/mysql_file.h"
#include "mysql/psi/mysql_memory.h"
#include "mysql/psi/mysql_mutex.h"
#include "mysql/strings/m_ctype.h"
#include "mysqld_error.h"
#include "sql/dd/types/event.h"
#include "sql/field.h"
#include "sql/handler.h"
#include "sql/psi_memory_key.h"
#include "sql/sql_const.h"
#include "sql/sql_error.h"
#include "sql/system_variables.h"
#include "sql/thr_malloc.h"
#include "sql/time_zone_common.h"
#include "sql/tzfile.h"
#include "string_with_len.h"
#include "template_utils.h"
#include "thr_lock.h"
#include "thr_mutex.h"
#include "sql/debug_sync.h"
#include "sql/log.h"
#include "sql/mysqld.h"
#include "sql/sql_base.h"
#include "sql/sql_class.h"
#include "sql/sql_time.h"
#include "sql/table.h"
#include "sql_string.h"
#include "strmake.h"
#include <string>
#include <unordered_map>
#include <utility>
#include "print_version.h"
#include "welcome_copyright_notice.h"
Classes | |
class | Time_zone_system |
class | Time_zone_utc |
class | Time_zone_db |
class | Time_zone_offset |
class | Tz_names_entry |
Macros | |
#define | LEAPS_THRU_END_OF(y) ((y) / 4 - (y) / 100 + (y) / 400) |
Functions | |
void | sec_to_TIME (MYSQL_TIME *tmp, my_time_t t, int64 offset) |
static uint | find_time_range (my_time_t t, const my_time_t *range_boundaries, uint higher_bound) |
static const TRAN_TYPE_INFO * | find_transition_type (my_time_t t, const TIME_ZONE_INFO *sp) |
static void | gmt_sec_to_TIME (MYSQL_TIME *tmp, my_time_t sec_in_utc, const TIME_ZONE_INFO *sp) |
static my_time_t | sec_since_epoch (int year, int mon, int mday, int hour, int min, int sec) |
static int64_t | sec_since_epoch64 (const MYSQL_TIME &mt) |
Converts time from a MYSQL_TIME struct to a unix timestamp-like 64 bit integer. More... | |
static my_time_t | sec_since_epoch (const MYSQL_TIME &mt) |
static my_time_t | TIME_to_gmt_sec (const MYSQL_TIME *t, const TIME_ZONE_INFO *sp, bool *in_dst_time_gap) |
Time_zone * | my_tz_find (const int64 displacement) |
static void | raise_time_zone_conversion_error (const MYSQL_TIME &mt) |
bool | check_time_zone_convertibility (const MYSQL_TIME &mt) |
Checks that this temporal value can be converted from its specified time zone (if any) to the current time zone. More... | |
bool | convert_time_zone_displacement (const Time_zone *tz, MYSQL_TIME *mt) |
Converts a date/time value with time zone to the corresponding date/time value without time zone, converted to be in time zone specified by argument tz . More... | |
static void | tz_init_table_list (Table_ref *tz_tabs) |
static void | init_tz_psi_keys (void) |
bool | my_tz_init (THD *org_thd, const char *default_tzname, bool bootstrap) |
void | my_tz_free () |
static Time_zone * | tz_load_from_open_tables (const String *tz_name, Table_ref *tz_tables) |
static bool | str_to_offset (const char *str, size_t length, int *offset) |
Time_zone * | my_tz_find (THD *thd, const String *name) |
Get Time_zone object for specified time zone. More... | |
#define LEAPS_THRU_END_OF | ( | y | ) | ((y) / 4 - (y) / 100 + (y) / 400) |
bool check_time_zone_convertibility | ( | const MYSQL_TIME & | mt | ) |
Checks that this temporal value can be converted from its specified time zone (if any) to the current time zone.
Specifically, temporal values with zero months or days cannot be converted between time zones.
mt | The time to check. |
false | The temporal value has no time zone or can be converted. |
true | Otherwise, and an error was raised. |
bool convert_time_zone_displacement | ( | const Time_zone * | tz, |
MYSQL_TIME * | mt | ||
) |
Converts a date/time value with time zone to the corresponding date/time value without time zone, converted to be in time zone specified by argument tz
.
Since MySQL doesn't have a data type for temporal values with time zone information, all such values are converted to a value without time zone using this function.
This function is intended only for values with a time zone, and is a no-op for all other types.
The converted value may not fall outside the range of the DATETIME
type. Also some invalid values cannot be converted because the conversion result would be undefined. In these cases an error is raised.
tz | The time zone to convert according to. | |
[in,out] | mt | Date/Time value to be converted. |
|
static |
|
static |
|
static |
|
static |
Get Time_zone object for specified time zone.
[in] | thd | Pointer to thread THD structure. |
[in] | name | Time zone specification. |
0 | bad time zone specification or other error. |
Time_zone | object pointer. |
void my_tz_free | ( | ) |
bool my_tz_init | ( | THD * | org_thd, |
const char * | default_tzname, | ||
bool | bootstrap | ||
) |
|
static |
|
static |
|
static |
|
static |
Converts time from a MYSQL_TIME struct to a unix timestamp-like 64 bit integer.
The function is guaranteed to use 64 bits on any platform.
mt | The time to convert. |
void sec_to_TIME | ( | MYSQL_TIME * | tmp, |
my_time_t | t, | ||
int64 | offset | ||
) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Time_zone* my_tz_OFFSET0 = &tz_OFFSET0 |
|
static |
|
static |
|
static |
|
static |
|
static |
This mutex has two orthogonal purposes:
It is not clear why the same mutex is used for both operations, or for that matter why it is taken even before we have decided which of the two paths above to take.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |