summaryrefslogtreecommitdiff
path: root/sql/time.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/time.cc')
-rw-r--r--sql/time.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/sql/time.cc b/sql/time.cc
index b6c91ff2148..249de3b879b 100644
--- a/sql/time.cc
+++ b/sql/time.cc
@@ -314,6 +314,11 @@ void localtime_to_TIME(MYSQL_TIME *to, struct tm *from)
void calc_time_from_sec(MYSQL_TIME *to, long seconds, long microseconds)
{
long t_seconds;
+ // to->neg is not cleared, it may already be set to a useful value
+ to->time_type= MYSQL_TIMESTAMP_TIME;
+ to->year= 0;
+ to->month= 0;
+ to->day= 0;
to->hour= seconds/3600L;
t_seconds= seconds%3600L;
to->minute= t_seconds/60L;