]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[3673] Updated comments about the max timestamp for the MySQL and PgSQL.
authorMarcin Siodelski <marcin@isc.org>
Wed, 11 Mar 2015 19:20:09 +0000 (20:20 +0100)
committerMarcin Siodelski <marcin@isc.org>
Wed, 11 Mar 2015 19:20:09 +0000 (20:20 +0100)
src/lib/dhcpsrv/mysql_lease_mgr.cc
src/lib/dhcpsrv/pgsql_lease_mgr.cc

index 45b42460b04ab53ed705f4c147d32d0c4df64d8b..34f91bdf019594610f055ed819667c7f542de7e5 100644 (file)
@@ -1287,7 +1287,8 @@ MySqlLeaseMgr::convertToDatabaseTime(const time_t cltt,
     int64_t expire_time_64 = static_cast<int64_t>(cltt) +
         static_cast<int64_t>(valid_lifetime);
 
-    // Prevent too large value.
+    // Even on 64-bit systems MySQL doesn't seem to accept the timestamps
+    // beyond the max value of int32_t.
     if (expire_time_64 > LeaseMgr::MAX_DB_TIME) {
         isc_throw(BadValue, "Time value is too large: " << expire_time_64);
     }
index dba5d34ac1d3e435284cdba7bf97b5b28a31317c..0bd20966c0b170ffd97257893545f27d6d0566e7 100644 (file)
@@ -315,10 +315,10 @@ public:
         int64_t expire_time_64 = static_cast<int64_t>(cltt) +
             static_cast<int64_t>(valid_lifetime);
 
-        // PostgreSQL does funny things with time if you get past Y2038.  It
-        // will accept the values (unlike MySQL which throws) but it
-        // stops correctly adjusting to local time when reading them back
-        // out. So lets disallow it here.
+        // On 32-bit systems the time_t is implemented as the int32_t value.
+        // We want to detect overflows beyond maximum int32_t value here
+        // to avoid the overflow in the PostgreSQL database. The PostgreSQL
+        // doesn't catch those overflows on its own.
         if (expire_time_64 > LeaseMgr::MAX_DB_TIME) {
             isc_throw(isc::BadValue, "Time value is too large: " << expire_time_64);
         }