From 2c12838925dc6fbc7d45ada0ddc40871c6a5d56b Mon Sep 17 00:00:00 2001 From: Constantin Michael Date: Sun, 4 Dec 2011 23:30:58 +0200 Subject: Handle microsecond resolution in PostgreSQL Qt date-time mappings --- odb/qt/date-time/pgsql/qdate-traits.hxx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'odb/qt/date-time/pgsql/qdate-traits.hxx') diff --git a/odb/qt/date-time/pgsql/qdate-traits.hxx b/odb/qt/date-time/pgsql/qdate-traits.hxx index 94345e1..67a60df 100644 --- a/odb/qt/date-time/pgsql/qdate-traits.hxx +++ b/odb/qt/date-time/pgsql/qdate-traits.hxx @@ -11,7 +11,6 @@ #include #include -#include namespace odb { @@ -38,7 +37,10 @@ namespace odb // v.setDate (0, 0, 0); else - v = QDate (2000, 1, 1).addDays (endian_traits::ntoh (i)); + { + const QDate pg_epoch (2000, 1, 1); + v = pg_epoch.addDays (endian_traits::ntoh (i)); + } } static void @@ -49,7 +51,8 @@ namespace odb else { is_null = false; - i = endian_traits::hton (QDate (2000, 1, 1).daysTo (v)); + const QDate pg_epoch (2000, 1, 1); + i = endian_traits::hton (pg_epoch.daysTo (v)); } } }; -- cgit v1.1