summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript/JS_Value.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-03-25 10:00:11 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-25 10:00:11 -0700
commit86a61dc374e8abe351df03a1aa6665013cc39345 (patch)
tree12e70780099343259eb24730744f53900643d181 /fpdfsdk/javascript/JS_Value.cpp
parent65ea3949de6536b1c122eadb4ac7828323fbc408 (diff)
downloadpdfium-86a61dc374e8abe351df03a1aa6665013cc39345.tar.xz
util.printd() replaces specified date with current date.
Added test case. Several bugs going on here: JS_LocalTime() ignoring argument and returning current time and not factoring in the time zone adjustment. Use of FXSYS_floor() silently casts result to float, losing precision required to extract minutes and seconds. Pre-existing wcsftime escapes not stripped. BUG=pdfium:413 Review URL: https://codereview.chromium.org/1833053002
Diffstat (limited to 'fpdfsdk/javascript/JS_Value.cpp')
-rw-r--r--fpdfsdk/javascript/JS_Value.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/fpdfsdk/javascript/JS_Value.cpp b/fpdfsdk/javascript/JS_Value.cpp
index 1da1525d09..5e403a524b 100644
--- a/fpdfsdk/javascript/JS_Value.cpp
+++ b/fpdfsdk/javascript/JS_Value.cpp
@@ -778,15 +778,15 @@ int JS_GetDayFromTime(double dt) {
}
int JS_GetHourFromTime(double dt) {
- return (int)_Mod(FXSYS_floor((double)(dt / (60 * 60 * 1000))), 24);
+ return (int)_Mod(floor(dt / (60 * 60 * 1000)), 24);
}
int JS_GetMinFromTime(double dt) {
- return (int)_Mod(FXSYS_floor((double)(dt / (60 * 1000))), 60);
+ return (int)_Mod(floor(dt / (60 * 1000)), 60);
}
int JS_GetSecFromTime(double dt) {
- return (int)_Mod(FXSYS_floor((double)(dt / 1000)), 60);
+ return (int)_Mod(floor(dt / 1000), 60);
}
double JS_DateParse(const wchar_t* str) {
@@ -820,7 +820,7 @@ double JS_DateParse(const wchar_t* str) {
double date = v->ToNumber(context).ToLocalChecked()->Value();
if (!_isfinite(date))
return date;
- return date + _getLocalTZA() + _getDaylightSavingTA(date);
+ return JS_LocalTime(date);
}
}
}
@@ -869,7 +869,7 @@ bool JS_PortIsNan(double d) {
}
double JS_LocalTime(double d) {
- return JS_GetDateTime() + _getDaylightSavingTA(d);
+ return d + _getLocalTZA() + _getDaylightSavingTA(d);
}
std::vector<CJS_Value> JS_ExpandKeywordParams(