Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2357)

Unified Diff: Source/wtf/DateMath.cpp

Issue 394903004: document.lastModified should consider user's local time zone (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Finger crossed Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/wtf/DateMath.cpp
diff --git a/Source/wtf/DateMath.cpp b/Source/wtf/DateMath.cpp
index 1c901b712d3aee23be9ea78c6c68e416efcab2d2..1c585c090382e7536ffc9393607c2947abe209ac 100644
--- a/Source/wtf/DateMath.cpp
+++ b/Source/wtf/DateMath.cpp
@@ -358,7 +358,7 @@ static int equivalentYearForDST(int year)
return year;
}
-int32_t calculateUTCOffset()
+static int32_t calculateUTCOffset()
{
#if OS(WIN)
TIME_ZONE_INFORMATION timeZoneInformation;
@@ -431,7 +431,7 @@ static double calculateDSTOffsetSimple(double localTimeSeconds, double utcOffset
}
// Get the DST offset, given a time in UTC
-double calculateDSTOffset(double ms, double utcOffset)
+static double calculateDSTOffset(double ms, double utcOffset)
{
// On Mac OS X, the call to localtime (see calculateDSTOffsetSimple) will return historically accurate
// DST information (e.g. New Zealand did not have DST from 1946 to 1974) however the JavaScript
@@ -881,4 +881,11 @@ String makeRFC2822DateString(unsigned dayOfWeek, unsigned day, unsigned month, u
return stringBuilder.toString();
}
+double convertToLocalTime(double ms)
+{
+ double utcOffset = calculateUTCOffset();
+ double dstOffset = calculateDSTOffset(ms, utcOffset);
+ return (ms + utcOffset + dstOffset);
+}
+
} // namespace WTF
« LayoutTests/http/tests/misc/last-modified-parsing.html ('K') | « Source/wtf/DateMath.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698