aboutsummaryrefslogtreecommitdiff
path: root/mapping
diff options
context:
space:
mode:
authorConstantin Michael <constantin@codesynthesis.com>2011-07-22 14:56:17 +0200
committerConstantin Michael <constantin@codesynthesis.com>2011-07-22 14:56:17 +0200
commit61f4a460fa3fb297b056597353e2e2f3330db7b3 (patch)
tree441e708a5258a666ce35071203f65b576efc7e88 /mapping
parentf64ea73680a7f21e841f16d3af886f943ac2f99d (diff)
Corrections to PostgreSQL traits implementation in mapping example
Diffstat (limited to 'mapping')
-rw-r--r--mapping/traits-pgsql.hxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/mapping/traits-pgsql.hxx b/mapping/traits-pgsql.hxx
index e196321..0b43c71 100644
--- a/mapping/traits-pgsql.hxx
+++ b/mapping/traits-pgsql.hxx
@@ -10,7 +10,7 @@
//
#include <cstring>
-#include <ctime>
+#include <ctime> // localtime, mktime, time_t, tm
#include <odb/pgsql/traits.hxx>
#include <odb/pgsql/details/endian-traits.hxx>
@@ -91,7 +91,7 @@ namespace odb
//
tm v_tm (*localtime (&v_tt));
- v = date (v_tm.tm_year + 1900, v_tm.tm_mon, v_tm.tm_mday);
+ v = date (v_tm.tm_year + 1900, v_tm.tm_mon + 1, v_tm.tm_mday);
}
static void
@@ -100,10 +100,10 @@ namespace odb
is_null = false;
tm v_tm;
- memset (&v_tm, 0, sizeof (v_tm));
+ std::memset (&v_tm, 0, sizeof (v_tm));
v_tm.tm_mday = v.day ();
- v_tm.tm_mon = v.month ();
+ v_tm.tm_mon = v.month () - 1;
v_tm.tm_year = v.year () - 1900;
time_t v_tt (mktime (&v_tm));