![]() |
MySQL 9.5.0
Source Code Documentation
|
Time_val is a temporal type that represents only time. More...
#include <my_temporal.h>
Public Member Functions | |
| Time_val () | |
| Time_val (bool negative, uint32_t hour, uint32_t minute, uint32_t second, uint32_t microsecond) | |
| Time_val (bool negative, uint32_t second, uint32_t microsecond) | |
| Time_val (const MYSQL_TIME &mtime) | |
| bool | is_negative () const |
| uint32_t | hour () const |
| uint32_t | minute () const |
| uint32_t | second () const |
| uint32_t | microsecond () const |
| int | compare (const Time_val arg) const |
| int64_t | for_comparison () const |
| bool | is_extreme_value (bool positive) const |
| Check against extreme values. More... | |
| void | set_zero () |
| Set zero time. More... | |
| void | set_extreme_value (bool negative) |
| Set extreme value. More... | |
| bool | operator== (const Time_val rhs) const |
| bool | operator< (const Time_val rhs) const |
| bool | add (Time_val tv, bool subtract) |
| Add a time value to another time value, or subtract it. More... | |
| bool | add (Interval &iv, bool subtract) |
| Add an interval to a time value, or subtract it. More... | |
| operator MYSQL_TIME () const | |
| Convert time value to the generalized temporal time format. More... | |
| int32_t | to_seconds () const |
| int64_t | to_microseconds () const |
| int64_t | to_int_rounded () const |
| base100 representation without microsecond, but rounded '-12:34:56.999999' is returned as -123457 More... | |
| int64_t | to_int_truncated () const |
| base100 representation without microsecond, '-12:34:56.999999' is returned as -123456 More... | |
| double | to_double () const |
| base100 representation with microseconds, returned as double precision float More... | |
| bool | is_adjusted (uint32_t decimals) const |
| uint32_t | actual_decimals () const |
| void | adjust_fraction (uint32_t decimals, bool round) |
| bool | add_nanoseconds_round (const int64_t nanoseconds) |
| void | store_time (uint8_t *ptr, uint32_t dec) const |
| Convert server time value to storage engine interface format. More... | |
| size_t | to_string (char *buffer, uint32_t dec) const |
| std::string | to_string () const |
Static Public Member Functions | |
| static bool | make_time (bool negative, uint32_t hour, uint32_t minute, uint32_t second, uint32_t microsecond, Time_val *time) |
| Static functions for creation. More... | |
| static Time_val | strip_date (const MYSQL_TIME &mt) |
| Creates a Time_val from a date_time by extracting only the time fields. More... | |
| static void | load_time (const uint8_t *ptr, uint32_t dec, Time_val *time) |
| Convert from storage engine interface time format to server time value. More... | |
Private Member Functions | |
| Time_val (int64_t val) | |
| void | set_microsecond (uint32_t fraction) |
| Set microsecond part of time value. More... | |
| bool | add_seconds (int32_t seconds) |
| bool | add_microseconds (int64_t mu) |
| bool | is_valid () const |
Static Private Member Functions | |
| static uint32_t | unsigned_seconds (uint32_t hour, uint32_t minute, uint32_t second) |
| static uint64_t | unsigned_microsec (uint32_t hour, uint32_t minute, uint32_t second, uint32_t microsec) |
Private Attributes | |
| uint64_t | m_value = 0xffffffffffffffff |
| A TIME value is stored in bit coded fields in a 64 bit unsigned value. More... | |
Static Private Attributes | |
| static constexpr const uint32_t | TIME_MAX_HOUR = 838 |
| static constexpr const uint32_t | TIME_MAX_MINUTE = 59 |
| static constexpr const uint32_t | TIME_MAX_SECOND = 59 |
| static constexpr const uint32_t | TIME_MAX_MICROSEC = 999999 |
| static constexpr uint64_t | TIME_MULT_SECOND = 1000000 |
| static constexpr uint64_t | TIME_MULT_MINUTE = 60000000 |
| static constexpr uint64_t | TIME_MULT_HOUR = 3600000000 |
| static constexpr uint64_t | BITS_MICROSEC = 0x0000000000FFFFFF |
| static constexpr uint64_t | BITS_SECOND = 0x000000003F000000 |
| static constexpr uint64_t | BITS_MINUTE = 0x0000000FC0000000 |
| static constexpr uint64_t | BITS_HOUR = 0x00007FF000000000 |
| static constexpr uint64_t | BITS_SIGN = 0x0000800000000000 |
| static constexpr int | TIME_SHIFT_SECOND = 24 |
| static constexpr int | TIME_SHIFT_MINUTE = 30 |
| static constexpr int | TIME_SHIFT_HOUR = 36 |
| static constexpr uint64_t | MAX_TIME_VALUE |
| static constexpr uint64_t | MIN_TIME_VALUE |
| static constexpr uint64_t | MAX_TIME_MICROSEC |
Time_val is a temporal type that represents only time.
It has constructors for creating time values from time components (hour, minute, second and microseconds), and from seconds and microseconds. It also has a constructor to create a value from a MYSQL_TIME value.
The range of values supported is from -838:59:59 to +838:59:59. The negative values, and the values from 24:00:00 and up are dedicated for use as a small-range interval type and should not be taken as a time within a day.
|
inline |
|
inline |
|
inline |
|
inlineexplicit |
|
inlineexplicitprivate |
|
inlineprivate |
|
inline |
|
inlineprivate |
|
inline |
|
inline |
|
inline |
|
inline |
Check against extreme values.
|
inline |
|
inlineprivate |
|
inlinestatic |
Static functions for creation.
Creates Time_val with range check. Minute, second and microsecond values must be within limits.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Set extreme value.
|
inlineprivate |
Set microsecond part of time value.
|
inline |
Set zero time.
|
inline |
|
inline |
|
inlinestaticprivate |
|
inlinestaticprivate |
|
staticconstexprprivate |
|
staticconstexprprivate |
|
staticconstexprprivate |
|
staticconstexprprivate |
|
staticconstexprprivate |
|
private |
A TIME value is stored in bit coded fields in a 64 bit unsigned value.
The format is efficient for comparison, storage, retrieval and movement. The fields are stored in two's complement, but with a sign bit set for non-negative values. This means that values can be compared using regular unsigned integer logic. Format: Bits 0-23: microseconds (0-999999) Bits 24-29: seconds (0-59) Bits 30-35: minutes (0-59) Bits 36-46: hours (0-838) (Theoretical range up to 2047) Bits 47-47: Sign (1 for positive value, 0 for negative value)
|
staticconstexprprivate |
|
staticconstexprprivate |
|
staticconstexprprivate |
|
staticconstexprprivate |
|
staticconstexprprivate |
|
staticconstexprprivate |
|
staticconstexprprivate |
|
staticconstexprprivate |
|
staticconstexprprivate |
|
staticconstexprprivate |
|
staticconstexprprivate |
|
staticconstexprprivate |
|
staticconstexprprivate |