summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorTatiana A. Nurnberg <azundris@mysql.com>2008-12-03 07:38:26 +0100
committerTatiana A. Nurnberg <azundris@mysql.com>2008-12-03 07:38:26 +0100
commit3edacb4f6dcb84280f4154dbcbce8fb4eb583597 (patch)
tree53b1549c3bea2f3daab548ffb55a1bf5aab115d3 /sql
parent085262146efaf2fa0a105984e3e389cb6a82703b (diff)
parent7f9e0b9bfb71bd3e47c48bb77f11df76feb1b7ad (diff)
downloadmariadb-git-3edacb4f6dcb84280f4154dbcbce8fb4eb583597.tar.gz
auto-merge
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_view.cc2
-rw-r--r--sql/tztime.cc22
-rw-r--r--sql/tztime.h3
3 files changed, 26 insertions, 1 deletions
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index 5bd3c09a289..41a638b2618 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -985,7 +985,7 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
if (index_list)
{
DBUG_ASSERT(index_list->head()); // should never fail
- my_error(ER_KEY_DOES_NOT_EXITS, MYF(0), index_list->head()->c_ptr_safe(),
+ my_error(ER_KEY_DOES_NOT_EXITS, MYF(0), index_list->head()->c_ptr(),
table->table_name);
DBUG_RETURN(TRUE);
}
diff --git a/sql/tztime.cc b/sql/tztime.cc
index 709e3b64752..d3d952e3c1e 100644
--- a/sql/tztime.cc
+++ b/sql/tztime.cc
@@ -1073,6 +1073,7 @@ Time_zone_system::gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const
localtime_r(&tmp_t, &tmp_tm);
localtime_to_TIME(tmp, &tmp_tm);
tmp->time_type= MYSQL_TIMESTAMP_DATETIME;
+ adjust_leap_second(tmp);
}
@@ -1157,6 +1158,7 @@ Time_zone_utc::gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const
gmtime_r(&tmp_t, &tmp_tm);
localtime_to_TIME(tmp, &tmp_tm);
tmp->time_type= MYSQL_TIMESTAMP_DATETIME;
+ adjust_leap_second(tmp);
}
@@ -1260,6 +1262,7 @@ void
Time_zone_db::gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const
{
::gmt_sec_to_TIME(tmp, t, tz_info);
+ adjust_leap_second(tmp);
}
@@ -2373,6 +2376,25 @@ Time_zone *my_tz_find_with_opening_tz_tables(THD *thd, const String *name)
DBUG_RETURN(tz);
}
+
+/**
+ Convert leap seconds into non-leap
+
+ This function will convert the leap seconds added by the OS to
+ non-leap seconds, e.g. 23:59:59, 23:59:60 -> 23:59:59, 00:00:01 ...
+ This check is not checking for years on purpose : although it's not a
+ complete check this way it doesn't require looking (and having installed)
+ the leap seconds table.
+
+ @param[in,out] broken down time structure as filled in by the OS
+*/
+
+void Time_zone::adjust_leap_second(MYSQL_TIME *t)
+{
+ if (t->second == 60 || t->second == 61)
+ t->second= 59;
+}
+
#endif /* !defined(TESTTIME) && !defined(TZINFO2SQL) */
diff --git a/sql/tztime.h b/sql/tztime.h
index 32a942a26e1..750b8dacbe1 100644
--- a/sql/tztime.h
+++ b/sql/tztime.h
@@ -55,6 +55,9 @@ public:
allocated on MEM_ROOT and should not require destruction.
*/
virtual ~Time_zone() {};
+
+protected:
+ static inline void adjust_leap_second(MYSQL_TIME *t);
};
extern Time_zone * my_tz_UTC;