#include "my_config.h"
#include "my_inttypes.h"
#include <sys/time.h>
#include "my_time_t.h"
#include "mysql_time.h"
Go to the source code of this file.
|
class | Time_zone |
| This class represents abstract time zone and provides basic interface for MYSQL_TIME <-> my_time_t conversion. More...
|
|
◆ check_time_zone_convertibility()
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.
- Parameters
-
- Return values
-
false | The temporal value has no time zone or can be converted. |
true | Otherwise, and an error was raised. |
◆ convert_time_zone_displacement()
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.
- Parameters
-
| tz | The time zone to convert according to. |
[in,out] | mt | Date/Time value to be converted. |
- Returns
- false on success. true if an error was raised.
◆ my_tz_find()
Get Time_zone object for specified time zone.
- Parameters
-
[in] | thd | Pointer to thread THD structure. |
[in] | name | Time zone specification. |
- Note
- This function checks if name is one of time zones described in db, predefined SYSTEM time zone or valid time zone specification as offset from UTC (In last case it will create proper Time_zone_offset object if there were not any.). If name is ok it returns corresponding Time_zone object.
-
Clients of this function are not responsible for releasing resources occupied by returned Time_zone object so they can just forget pointers to Time_zone object if they are not needed longer.
-
Other important property of this function: if some Time_zone found once it will be for sure found later, so this function can also be used for checking if proper Time_zone object exists (and if there will be error it will be reported during first call).
-
If name pointer is 0 then this function returns 0 (this allows to pass 0 values as parameter without additional external check and this property is used by @time_zone variable handling code).
-
It will perform lookup in system tables (mysql.time_zone*), opening and locking them, and closing afterwards. It won't perform such lookup if no time zone describing tables were found during server start up.
- Return values
-
0 | bad time zone specification or other error. |
Time_zone | object pointer. |
◆ my_tz_free()
◆ my_tz_init()
bool my_tz_init |
( |
THD * |
org_thd, |
|
|
const char * |
default_tzname, |
|
|
bool |
bootstrap |
|
) |
| |
◆ sec_since_epoch_TIME()
◆ sec_to_TIME()
◆ use_input_time_zone()
◆ my_tz_OFFSET0
◆ my_tz_SYSTEM
◆ MY_TZ_TABLES_COUNT
const int MY_TZ_TABLES_COUNT = 4 |
|
static |
Number of elements in table list produced by my_tz_get_table_list() (this table list contains tables which are needed for dynamical loading of time zone descriptions).
Actually it is implementation detail that should not be used anywhere outside of tztime.h and tztime.cc.
◆ my_tz_UTC