Commit e016a2f5 authored by Sergei Golubchik's avatar Sergei Golubchik

lp:705210 Compiling with BUILD/compile-pentium64-debug fails

parent c41b66c0
......@@ -902,10 +902,10 @@ void my_diff_and_hrtime(my_timediff_t *interval, my_hrtime_t *timestamp);
extern ulonglong my_getsystime(void);
#define my_micro_time() (my_getsystime()/10)
#define hrtime_to_time(X) ((my_time_t)((X).val/1000000))
#define hrtime_to_time(X) ((X).val/1000000)
#define hrtime_from_time(X) ((ulonglong)((X)*1000000ULL))
#define hrtime_to_double(X) ((X).val/1e6)
#define hrtime_sec_part(X) ((X).val%1000000)
#define hrtime_sec_part(X) ((ulong)((X).val%1000000))
#define my_time(X) hrtime_to_time(my_hrtime())
#define my_micro_and_hrtime(X,Y) my_diff_and_hrtime(X,Y)
......
......@@ -158,9 +158,12 @@ static inline longlong sec_part_unshift(longlong second_part, int digits)
}
static inline ulong sec_part_truncate(ulong second_part, int digits)
{
return second_part - second_part % log_10_int[MAX_SEC_PART_DIGITS - digits];
/* the cast here should be unnecessary! */
return second_part - second_part % (ulong)log_10_int[MAX_SEC_PART_DIGITS - digits];
}
#define hrtime_to_my_time(X) ((my_time_t)hrtime_to_time(X))
/*
Available interval types used in any statement.
......
......@@ -17,7 +17,7 @@
#include "mysys_priv.h"
#include <m_string.h>
#include <my_time.h>
/*
get date as string
......
......@@ -108,10 +108,7 @@ void my_diff_and_hrtime(my_timediff_t *interval, my_hrtime_t *timestamp)
{
interval->val= my_getsystime() / 10;
#if defined(__WIN__) || defined(HAVE_GETHRTIME)
{
my_hrtime_t t= my_hrtime();
timestamp->val= t.val;
}
*timestamp= my_hrtime();
#else
timestamp->val= interval->val;
#endif
......
......@@ -1351,7 +1351,7 @@ longlong pack_time(MYSQL_TIME *my_time)
my_time->second_part) * (my_time->neg ? -1 : 1);
}
#define get_one(WHERE, FACTOR) WHERE= packed % FACTOR; packed/= FACTOR
#define get_one(WHERE, FACTOR) WHERE= (ulong)(packed % FACTOR); packed/= FACTOR
MYSQL_TIME *unpack_time(longlong packed, MYSQL_TIME *my_time)
{
......
This diff is collapsed.
......@@ -873,7 +873,7 @@ get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg,
longlong res;
if (t_type == MYSQL_TIMESTAMP_TIME)
res= number_to_time(value, &buf, &was_cut);
res= number_to_time((double)value, &buf, &was_cut);
else
res= number_to_datetime(value, &buf, TIME_INVALID_DATES|TIME_FUZZY_DATE,
&was_cut);
......
......@@ -1610,7 +1610,7 @@ void Item_func_sysdate_local::store_now_in_TIME(MYSQL_TIME *now_time)
{
THD *thd= current_thd;
my_hrtime_t now= my_hrtime();
thd->variables.time_zone->gmt_sec_to_TIME(now_time, hrtime_to_time(now));
thd->variables.time_zone->gmt_sec_to_TIME(now_time, hrtime_to_my_time(now));
set_sec_part(hrtime_sec_part(now), now_time, this);
thd->time_zone_used= 1;
}
......
......@@ -1719,11 +1719,11 @@ log_event_print_value(IO_CACHE *file, const uchar *ptr,
case MYSQL_TYPE_DATETIME:
{
size_t d, t;
uint d, t;
uint64 i64= uint8korr(ptr); /* YYYYMMDDhhmmss */
d= i64 / 1000000;
t= i64 % 1000000;
my_b_printf(file, "%04d-%02d-%02d %02d:%02d:%02d",
d= (uint)(i64 / 1000000);
t= (uint)(i64 % 1000000);
my_b_printf(file, "%04u-%02u-%02u %02u:%02u:%02u",
d / 10000, (d % 10000) / 100, d % 100,
t / 10000, (t % 10000) / 100, t % 100);
my_snprintf(typestr, typestr_length, "DATETIME");
......
......@@ -1022,7 +1022,7 @@ class Log_event
return when;
}
my_hrtime_t hrtime= my_hrtime();
when= hrtime_to_time(hrtime);
when= hrtime_to_my_time(hrtime);
when_sec_part= hrtime_sec_part(hrtime);
return when;
}
......
......@@ -2154,7 +2154,7 @@ int apply_event_and_update_pos(Log_event* ev, THD* thd, Relay_log_info* rli)
if (!ev->when)
{
my_hrtime_t hrtime= my_hrtime();
ev->when= hrtime_to_time(hrtime);
ev->when= hrtime_to_my_time(hrtime);
ev->when_sec_part= hrtime_sec_part(hrtime);
}
ev->thd = thd; // because up to this point, ev->thd == 0
......
......@@ -2026,7 +2026,7 @@ class THD :public Statement,
{
if (user_time.val)
{
start_time= hrtime_to_time(user_time);
start_time= hrtime_to_my_time(user_time);
start_time_sec_part= hrtime_sec_part(user_time);
start_utime= utime_after_lock= my_micro_time();
}
......@@ -2035,7 +2035,7 @@ class THD :public Statement,
my_hrtime_t hrtime;
my_timediff_t timediff;
my_micro_and_hrtime(&timediff, &hrtime);
start_time= hrtime_to_time(hrtime);
start_time= hrtime_to_my_time(hrtime);
start_time_sec_part= hrtime_sec_part(hrtime);
utime_after_lock= start_utime= timediff.val;
}
......@@ -2043,13 +2043,13 @@ class THD :public Statement,
inline void set_current_time()
{
my_hrtime_t hrtime= my_hrtime();
start_time= hrtime_to_time(hrtime);
start_time= hrtime_to_my_time(hrtime);
start_time_sec_part= hrtime_sec_part(hrtime);
}
inline void set_time(my_hrtime_t t)
{
user_time= t;
start_time= hrtime_to_time(user_time);
start_time= hrtime_to_my_time(user_time);
start_time_sec_part= hrtime_sec_part(user_time);
start_utime= utime_after_lock= my_micro_time();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment