diff options
-rw-r--r-- | odb/qt/date-time/mysql/qdate-time-traits.hxx | 16 | ||||
-rw-r--r-- | odb/qt/date-time/mysql/qtime-traits.hxx | 8 |
2 files changed, 15 insertions, 9 deletions
diff --git a/odb/qt/date-time/mysql/qdate-time-traits.hxx b/odb/qt/date-time/mysql/qdate-time-traits.hxx index 87c62b1..6aa0f55 100644 --- a/odb/qt/date-time/mysql/qdate-time-traits.hxx +++ b/odb/qt/date-time/mysql/qdate-time-traits.hxx @@ -30,12 +30,15 @@ namespace odb // v = QDateTime (); else + // Since MySQL 5.6.4, the microseconds part is no longer ignored. + // v = QDateTime (QDate (static_cast<int> (i.year), static_cast<int> (i.month), static_cast<int> (i.day)), QTime (static_cast<int> (i.hour), static_cast<int> (i.minute), - static_cast<int> (i.second))); + static_cast<int> (i.second), + static_cast<int> (i.second_part / 1000))); } static void @@ -61,8 +64,7 @@ namespace odb i.hour = static_cast<unsigned int> (t.hour ()); i.minute = static_cast<unsigned int> (t.minute ()); i.second = static_cast<unsigned int> (t.second ()); - - i.second_part = 0; + i.second_part = static_cast<unsigned long> (t.msec ()) * 1000; } } }; @@ -82,12 +84,15 @@ namespace odb // v = QDateTime (); else + // Since MySQL 5.6.4, the microseconds part is no longer ignored. + // v = QDateTime (QDate (static_cast<int> (i.year), static_cast<int> (i.month), static_cast<int> (i.day)), QTime (static_cast<int> (i.hour), static_cast<int> (i.minute), - static_cast<int> (i.second))); + static_cast<int> (i.second), + static_cast<int> (i.second_part / 1000))); } static void @@ -113,8 +118,7 @@ namespace odb i.hour = static_cast<unsigned int> (t.hour ()); i.minute = static_cast<unsigned int> (t.minute ()); i.second = static_cast<unsigned int> (t.second ()); - - i.second_part = 0; + i.second_part = static_cast<unsigned long> (t.msec ()) * 1000; } } }; diff --git a/odb/qt/date-time/mysql/qtime-traits.hxx b/odb/qt/date-time/mysql/qtime-traits.hxx index ad4ff10..4fbf4dd 100644 --- a/odb/qt/date-time/mysql/qtime-traits.hxx +++ b/odb/qt/date-time/mysql/qtime-traits.hxx @@ -32,9 +32,12 @@ namespace odb // v.setHMS (24, 0, 0); else + // Since MySQL 5.6.4, the microseconds part is no longer ignored. + // v.setHMS (static_cast<int> (i.hour), static_cast<int> (i.minute), - static_cast<int> (i.second)); + static_cast<int> (i.second), + static_cast<int> (i.second_part / 1000)); } static void @@ -54,8 +57,7 @@ namespace odb i.hour = static_cast<unsigned int> (v.hour ()); i.minute = static_cast<unsigned int> (v.minute ()); i.second = static_cast<unsigned int> (v.second ()); - - i.second_part = 0; + i.second_part = static_cast<unsigned long> (v.msec ()) * 1000; } } }; |