83
83
if (not temporal.from_string(from, (size_t) len))
85
my_error(ER_INVALID_UNIX_TIMESTAMP_VALUE, MYF(ME_FATALERROR), from);
85
std::string tmp(boost::lexical_cast<std::string>(from));
86
my_error(ER_INVALID_TIME_VALUE, MYF(0), tmp.c_str());
94
95
int Time::store(double from)
96
97
ASSERT_COLUMN_MARKED_FOR_WRITE;
100
if (from > (double)TIME_MAX_VALUE)
103
set_datetime_warning(DRIZZLE_ERROR::WARN_LEVEL_WARN,
104
ER_WARN_DATA_OUT_OF_RANGE, from, type::DRIZZLE_TIMESTAMP_TIME);
107
else if (from < (double) - TIME_MAX_VALUE)
109
tmp= -TIME_MAX_VALUE;
110
set_datetime_warning(DRIZZLE_ERROR::WARN_LEVEL_WARN,
111
ER_WARN_DATA_OUT_OF_RANGE, from, type::DRIZZLE_TIMESTAMP_TIME);
116
tmp=(long) floor(fabs(from)); // Remove fractions
121
if (tmp % 100 > 59 || tmp/100 % 100 > 59)
124
set_datetime_warning(DRIZZLE_ERROR::WARN_LEVEL_WARN,
125
ER_WARN_DATA_OUT_OF_RANGE, from,
126
type::DRIZZLE_TIMESTAMP_TIME);
103
if (from > (double)TIME_MAX_VALUE)
108
else if (from < (double) - TIME_MAX_VALUE)
110
tmp= -TIME_MAX_VALUE;
115
tmp=(long) floor(fabs(from)); // Remove fractions
120
if (tmp % 100 > 59 || tmp/100 % 100 > 59)
132
126
return store(tmp, false);
130
std::string tmp(boost::lexical_cast<std::string>(from));
131
my_error(ER_INVALID_TIME_VALUE, MYF(0), tmp.c_str());
137
136
int Time::store(int64_t from, bool)
143
142
* if unable to create a valid DateTime.
145
144
drizzled::Time temporal;
146
if (! temporal.from_time_t(from))
145
if (not temporal.from_time_t(from))
148
147
/* Convert the integer to a string using boost::lexical_cast */
149
148
std::string tmp(boost::lexical_cast<std::string>(from));
151
my_error(ER_INVALID_UNIX_TIMESTAMP_VALUE, MYF(ME_FATALERROR), tmp.c_str());
149
my_error(ER_INVALID_TIME_VALUE, MYF(0), tmp.c_str());