Converting date string to seconds fixed
authorHojong Han <hojong.han@samsung.com>
Tue, 16 Apr 2013 01:00:49 +0000 (10:00 +0900)
committerGerrit Code Review <gerrit2@kim11>
Wed, 17 Apr 2013 04:14:22 +0000 (13:14 +0900)
[Title] Converting date string to seconds fixed
[Issue#] DCM-1358
[Problem] Date string is not correctly converted to seconds
[Cause] There's implicit cast from int to double
[Solution] Constants fixed not to be considered as double

Change-Id: Ia68f491955dc47b516cc6781f062937b4844ef2f

Source/WTF/wtf/DateMath.cpp

index dc7a17a..e3fc329 100644 (file)
@@ -464,9 +464,9 @@ void initializeDates()
 static inline double ymdhmsToSeconds(long year, int mon, int day, int hour, int minute, double second)
 {
     double days = (day - 32075)
-        + floor(1461 * (year + 4800.0 + (mon - 14) / 12) / 4)
+        + floor(1461 * (year + 4800 + (mon - 14) / 12) / 4)
         + 367 * (mon - 2 - (mon - 14) / 12 * 12) / 12
-        - floor(3 * ((year + 4900.0 + (mon - 14) / 12) / 100) / 4)
+        - floor(3 * ((year + 4900 + (mon - 14) / 12) / 100) / 4)
         - 2440588;
     return ((days * hoursPerDay + hour) * minutesPerHour + minute) * secondsPerMinute + second;
 }