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

Unified Diff: runtime/vm/os_win.cc

Issue 9969098: Set the TZ env to get the UTC-ms since epoch. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments and rebased. Created 8 years, 8 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
« runtime/vm/os_macos.cc ('K') | « runtime/vm/os_macos.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/os_win.cc
diff --git a/runtime/vm/os_win.cc b/runtime/vm/os_win.cc
index 420a06876e5fd79a5da6857c930a67d59feaf706..6e1c1d9b027d4e265ab398e4ac80225f79f95f19 100644
--- a/runtime/vm/os_win.cc
+++ b/runtime/vm/os_win.cc
@@ -18,9 +18,6 @@ bool OS::BreakDownSecondsSinceEpoch(time_t seconds_since_epoch,
if (in_utc) {
error_code = gmtime_s(&tm_result, &seconds_since_epoch);
} else {
- // TODO(floitsch): we should be able to call tzset only once during
- // initialization.
- tzset(); // Make sure the libc knows about the local zone.
cshapiro 2012/04/19 23:52:12 Why was this removed? The documentation states th
floitsch 2012/04/20 16:09:57 localtime_s only looks at the env variable. tzset
error_code = localtime_s(&tm_result, &seconds_since_epoch);
}
result->year = tm_result.tm_year;
@@ -46,25 +43,19 @@ bool OS::BrokenDownToSecondsSinceEpoch(
// Set wday to an impossible day, so that we can catch bad input.
tm_broken_down.tm_wday = -1;
// Make sure the libc knows about the local zone.
- // In case of 'in_utc' this call is mainly for multi-threading issues. If
- // another thread uses a time-function it will set the timezone. The timezone
- // adjustement below would then not work anymore.
// TODO(floitsch): we should be able to call tzset only once during
// initialization.
tzset();
cshapiro 2012/04/19 23:52:12 Why is this being called before a conversion for a
floitsch 2012/04/20 16:09:57 Looking through the docs it looks as calling tzset
if (in_utc) {
// Disable daylight saving in utc mode.
tm_broken_down.tm_isdst = 0;
- // mktime assumes that the given date is local time zone.
- *result = mktime(&tm_broken_down);
- // Remove the timezone.
- *result -= timezone;
+ *result = _mkgmtime(&tm_broken_down);
} else {
// Let libc figure out if daylight saving is active.
tm_broken_down.tm_isdst = -1;
*result = mktime(&tm_broken_down);
}
- if ((*result == -1) && (tm_broken_down.tm_wday == -1)) {
+ if ((*result == -1 || *result == 1) && (tm_broken_down.tm_wday == -1)) {
cshapiro 2012/04/19 23:52:12 How is returning 1 an error?
floitsch 2012/04/20 16:09:57 Couldn't find any reference to it either. Probably
return false;
}
return true;
« runtime/vm/os_macos.cc ('K') | « runtime/vm/os_macos.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698