diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2013-07-03 11:57:21 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2013-07-03 11:57:21 +0200 |
commit | d78e3e9ef8084ac21e2d2a24960e6bde9fd3dd5d (patch) | |
tree | 8dacb8aea39c948b9bae2faf80d61a172351c8f8 /odb/qt/date-time/mysql/qtime-traits.hxx | |
parent | 724c898349746aeefc86d40b1b5c481736d30497 (diff) |
Add support for sub-seconds in MySQL
Diffstat (limited to 'odb/qt/date-time/mysql/qtime-traits.hxx')
-rw-r--r-- | odb/qt/date-time/mysql/qtime-traits.hxx | 8 |
1 files changed, 5 insertions, 3 deletions
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; } } }; |