1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

More windows changes for 32 bit unsigned timestamp:

MDEV-32188 make TIMESTAMP use whole 32-bit unsigned range

- Changed usage of timeval to my_timeval as the timeval parts on windows
  are 32-bit long, which causes some compiler issues on windows.
This commit is contained in:
Monty
2023-09-18 17:30:22 +03:00
committed by Sergei Golubchik
parent b8ffd99cee
commit b879b8a5c8
16 changed files with 79 additions and 58 deletions

View File

@ -390,7 +390,7 @@ bool Timestamp::to_native(Native *to, uint decimals) const
bool Timestamp::to_TIME(THD *thd, MYSQL_TIME *to, date_mode_t fuzzydate) const
{
return thd->timestamp_to_TIME(to, tv_sec, tv_usec, fuzzydate);
return thd->timestamp_to_TIME(to, (my_time_t) tv_sec, tv_usec, fuzzydate);
}
@ -450,7 +450,7 @@ int Timestamp_or_zero_datetime_native::save_in_field(Field *field,
static Datetime zero(Datetime::zero());
return field->store_time_dec(zero.get_mysql_time(), decimals);
}
return field->store_timestamp_dec(Timestamp(*this).tv(), decimals);
return field->store_timestamp_dec(Timestamp(*this), decimals);
}
@ -782,9 +782,9 @@ void Timestamp::round_or_set_max(uint dec, int *warn)
{
DBUG_ASSERT(dec <= TIME_SECOND_PART_DIGITS);
if (add_nanoseconds_usec(msec_round_add[dec]) &&
(ulonglong) tv_sec++ >= TIMESTAMP_MAX_VALUE)
tv_sec++ >= TIMESTAMP_MAX_VALUE)
{
tv_sec= (time_t) TIMESTAMP_MAX_VALUE;
tv_sec= TIMESTAMP_MAX_VALUE;
tv_usec= TIME_MAX_SECOND_PART;
*warn|= MYSQL_TIME_WARN_OUT_OF_RANGE;
}
@ -1053,9 +1053,9 @@ void Datetime::make_from_datetime(THD *thd, int *warn, const MYSQL_TIME *from,
}
Datetime::Datetime(THD *thd, const timeval &tv)
Datetime::Datetime(THD *thd, const my_timeval &tv)
{
thd->variables.time_zone->gmt_sec_to_TIME(this, tv.tv_sec);
thd->variables.time_zone->gmt_sec_to_TIME(this, (my_time_t) tv.tv_sec);
second_part= tv.tv_usec;
thd->used|= THD::TIME_ZONE_USED;
DBUG_ASSERT(is_valid_value_slow());