MySQL 9.5.0
Source Code Documentation
Collaboration diagram for Mysys temporal utilities:

Files

file  my_temporal.h
 Server classes for temporal handling (DATE, TIME, DATETIME)
 
file  my_temporal.cc
 Implementation of low level date, time and datetime utilities.
 

Functions

bool Time_val::is_adjusted (uint32_t decimals) const
 
uint32_t Time_val::actual_decimals () const
 
void Time_val::adjust_fraction (uint32_t decimals, bool round)
 
bool Time_val::add (Time_val tv, bool subtract)
 Add a time value to another time value, or subtract it. More...
 
bool Time_val::add (Interval &iv, bool subtract)
 Add an interval to a time value, or subtract it. More...
 
static Time_val Time_val::strip_date (const MYSQL_TIME &mt)
 Creates a Time_val from a date_time by extracting only the time fields. More...
 
 Time_val::operator MYSQL_TIME () const
 Convert time value to the generalized temporal time format. More...
 
void Time_val::store_time (uint8_t *ptr, uint32_t dec) const
 Convert server time value to storage engine interface format. More...
 
static void Time_val::load_time (const uint8_t *ptr, uint32_t dec, Time_val *time)
 Convert from storage engine interface time format to server time value. More...
 
int64_t Time_val::to_int_rounded () const
 base100 representation without microsecond, but rounded '-12:34:56.999999' is returned as -123457 More...
 
int64_t Time_val::to_int_truncated () const
 base100 representation without microsecond, '-12:34:56.999999' is returned as -123456 More...
 
double Time_val::to_double () const
 base100 representation with microseconds, returned as double precision float More...
 
size_t Time_val::to_string (char *buffer, uint32_t dec) const
 
std::string Time_val::to_string () const
 

Variables

static const uint32_t divisors [] = {1000000, 100000, 10000, 1000, 100, 10}
 

Detailed Description

Function Documentation

◆ actual_decimals()

uint32_t Time_val::actual_decimals ( ) const
Returns
actual number of decimals in fraction

◆ add() [1/2]

bool Time_val::add ( Interval iv,
bool  subtract 
)

Add an interval to a time value, or subtract it.

Parameters
ivInterval to add or subtract
subtractIf true, subtract the time value, otherwise add it.
Returns
false if result is within valid time range, true otherwise.

◆ add() [2/2]

bool Time_val::add ( Time_val  tv,
bool  subtract 
)

Add a time value to another time value, or subtract it.

Parameters
tvTime value to add or subtract
subtractIf true, subtract the time value, otherwise add it.
Returns
false if result is within valid time range, true otherwise.

◆ adjust_fraction()

void Time_val::adjust_fraction ( uint32_t  decimals,
bool  round 
)

◆ is_adjusted()

bool Time_val::is_adjusted ( uint32_t  decimals) const
Returns
true if value is adjusted to number of decimals in fraction

◆ load_time()

void Time_val::load_time ( const uint8_t *  ptr,
uint32_t  dec,
Time_val time 
)
static

Convert from storage engine interface time format to server time value.

Parameters
ptrThe pointer to read the value at.
decPrecision.
[out]timeReturned time value

◆ operator MYSQL_TIME()

Time_val::operator MYSQL_TIME ( ) const
explicit

Convert time value to the generalized temporal time format.

◆ store_time()

void Time_val::store_time ( uint8_t *  ptr,
uint32_t  dec 
) const

Convert server time value to storage engine interface format.

Parameters
[out]ptrThe buffer to put value at.
decPrecision.

◆ strip_date()

Time_val Time_val::strip_date ( const MYSQL_TIME mt)
static

Creates a Time_val from a date_time by extracting only the time fields.

◆ to_double()

double Time_val::to_double ( ) const

base100 representation with microseconds, returned as double precision float

◆ to_int_rounded()

int64_t Time_val::to_int_rounded ( ) const

base100 representation without microsecond, but rounded '-12:34:56.999999' is returned as -123457

◆ to_int_truncated()

int64_t Time_val::to_int_truncated ( ) const

base100 representation without microsecond, '-12:34:56.999999' is returned as -123456

◆ to_string() [1/2]

std::string Time_val::to_string ( ) const

◆ to_string() [2/2]

size_t Time_val::to_string ( char *  buffer,
uint32_t  dec 
) const

Variable Documentation

◆ divisors

const uint32_t divisors[] = {1000000, 100000, 10000, 1000, 100, 10}
static