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

Unified Diff: src/platform-win32.cc

Issue 9600018: Remove dependency on _mkgmtime to determine local timezone offset (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform-win32.cc
===================================================================
--- src/platform-win32.cc (revision 10923)
+++ src/platform-win32.cc (working copy)
@@ -66,16 +66,8 @@
#ifndef __MINGW64_VERSION_MAJOR
-
-// Not sure this the correct interpretation of _mkgmtime
-time_t _mkgmtime(tm* timeptr) {
- return mktime(timeptr);
-}
-
-
#define _TRUNCATE 0
#define STRUNCATE 80
-
#endif // __MINGW64_VERSION_MAJOR
@@ -516,11 +508,13 @@
// Convert to local time, as struct with fields for day, hour, year, etc.
tm posix_local_time_struct;
if (localtime_s(&posix_local_time_struct, &posix_time)) return 0;
- // Convert local time in struct to POSIX time as if it were a UTC time.
- time_t local_posix_time = _mkgmtime(&posix_local_time_struct);
- Time localtime(1000.0 * local_posix_time);
- return localtime.Diff(&rounded_to_second);
+ if (posix_local_time_struct.tm_isdst > 0)
+ return (tzinfo_.Bias + tzinfo_.DaylightBias) * -kMsPerMinute;
+ else if (posix_local_time_struct.tm_isdst == 0)
+ return (tzinfo_.Bias + tzinfo_.StandardBias) * -kMsPerMinute;
+ else
+ return tzinfo_.Bias * -kMsPerMinute;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698