Parcourir la source

[master] corrected the type for the time in timeFromText64().

the previous code used time_t, as a result of copying the pre #61 version,
which may not always be 64-bit.
JINMEI Tatuya il y a 14 ans
Parent
commit
f3e39622ac
2 fichiers modifiés avec 2 ajouts et 2 suppressions
  1. 1 1
      src/lib/dns/dnssectime.cc
  2. 1 1
      src/lib/dns/tests/dnssectime_unittest.cc

+ 1 - 1
src/lib/dns/dnssectime.cc

@@ -186,7 +186,7 @@ timeFromText64(const string& time_txt) {
     checkRange(0, 59, minute, "minute");
     checkRange(0, 60, second, "second"); // 60 == leap second.
 
-    time_t timeval = second + (60 * minute) + (3600 * hour) +
+    uint64_t timeval = second + (60 * minute) + (3600 * hour) +
         ((day - 1) * 86400);
     for (int m = 0; m < (month - 1); ++m) {
             timeval += days[m] * 86400;

+ 1 - 1
src/lib/dns/tests/dnssectime_unittest.cc

@@ -90,7 +90,7 @@ TEST_F(DNSSECTimeTest, fromText) {
     // On the other hand, the 64-bit version should return monotonically
     // increasing counters.
     EXPECT_EQ(4294967296LL, timeFromText64("21060207062816"));
-    EXPECT_EQ(4294967306LL, timeFromText64("21060207062826"));
+    EXPECT_EQ(static_cast<uint64_t>(4294967306LL), timeFromText64("21060207062826"));
 }
 
 // This helper templated function tells timeToText32 a faked current time.