Index: fpdfsdk/src/javascript/JS_Value.cpp |
diff --git a/fpdfsdk/src/javascript/JS_Value.cpp b/fpdfsdk/src/javascript/JS_Value.cpp |
index ea7bfda57ad712bd81b710fbf18bcd4f6ccf724f..327d6578f03e75b8cdfadbcef602f7dd8518311c 100644 |
--- a/fpdfsdk/src/javascript/JS_Value.cpp |
+++ b/fpdfsdk/src/javascript/JS_Value.cpp |
@@ -649,7 +649,7 @@ int _DayFromYear(int y) { |
} |
double _TimeFromYear(int y) { |
- return ((double)86400000) * _DayFromYear(y); |
+ return 86400000.0 * _DayFromYear(y); |
} |
double _TimeFromYearMonth(int y, int m) { |
@@ -669,12 +669,12 @@ int _Day(double t) { |
int _YearFromTime(double t) { |
// estimate the time. |
- int y = 1970 + (int)(t / (365.0 * 86400000)); |
+ int y = 1970 + (int)(t / (365.2425 * 86400000)); |
Oliver Chang
2015/12/21 17:59:12
nit: get rid of the C style cast while we're here?
Lei Zhang
2015/12/21 18:46:50
Done.
|
if (_TimeFromYear(y) <= t) { |
while (_TimeFromYear(y + 1) <= t) |
y++; |
} else |
- while (_TimeFromYear(y - 1) > t) |
+ while (_TimeFromYear(y) > t) |
y--; |
return y; |
} |