mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-16991 Rounding vs truncation for TIME, DATETIME, TIMESTAMP
This commit is contained in:
@ -268,7 +268,8 @@ int str2my_decimal(uint mask, const char *from, size_t length,
|
||||
integer part cannot be larger that 1e18 (otherwise it's an overflow).
|
||||
fractional part is microseconds.
|
||||
*/
|
||||
bool my_decimal2seconds(const my_decimal *d, ulonglong *sec, ulong *microsec)
|
||||
bool my_decimal2seconds(const my_decimal *d, ulonglong *sec,
|
||||
ulong *microsec, ulong *nanosec)
|
||||
{
|
||||
int pos;
|
||||
|
||||
@ -286,6 +287,7 @@ bool my_decimal2seconds(const my_decimal *d, ulonglong *sec, ulong *microsec)
|
||||
}
|
||||
|
||||
*microsec= d->frac ? static_cast<longlong>(d->buf[pos+1]) / (DIG_BASE/1000000) : 0;
|
||||
*nanosec= d->frac ? static_cast<longlong>(d->buf[pos+1]) % (DIG_BASE/1000000) : 0;
|
||||
|
||||
if (pos > 1)
|
||||
{
|
||||
|
Reference in New Issue
Block a user