Commit f3e39622 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

[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.
parent f9ed88b3
...@@ -186,7 +186,7 @@ timeFromText64(const string& time_txt) { ...@@ -186,7 +186,7 @@ timeFromText64(const string& time_txt) {
checkRange(0, 59, minute, "minute"); checkRange(0, 59, minute, "minute");
checkRange(0, 60, second, "second"); // 60 == leap second. 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); ((day - 1) * 86400);
for (int m = 0; m < (month - 1); ++m) { for (int m = 0; m < (month - 1); ++m) {
timeval += days[m] * 86400; timeval += days[m] * 86400;
......
...@@ -90,7 +90,7 @@ TEST_F(DNSSECTimeTest, fromText) { ...@@ -90,7 +90,7 @@ TEST_F(DNSSECTimeTest, fromText) {
// On the other hand, the 64-bit version should return monotonically // On the other hand, the 64-bit version should return monotonically
// increasing counters. // increasing counters.
EXPECT_EQ(4294967296LL, timeFromText64("21060207062816")); 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. // This helper templated function tells timeToText32 a faked current time.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment