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

Side by Side Diff: src/platform-cygwin.cc

Issue 197023002: Fix a race in initialization of timezone cache in platform-win32. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix CE Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/platform.h ('k') | src/platform-freebsd.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #include "platform.h" 44 #include "platform.h"
45 #include "simulator.h" 45 #include "simulator.h"
46 #include "v8threads.h" 46 #include "v8threads.h"
47 #include "vm-state-inl.h" 47 #include "vm-state-inl.h"
48 #include "win32-headers.h" 48 #include "win32-headers.h"
49 49
50 namespace v8 { 50 namespace v8 {
51 namespace internal { 51 namespace internal {
52 52
53 53
54 const char* OS::LocalTimezone(double time) { 54 const char* OS::LocalTimezone(double time, TimezoneCache* cache) {
55 if (std::isnan(time)) return ""; 55 if (std::isnan(time)) return "";
56 time_t tv = static_cast<time_t>(std::floor(time/msPerSecond)); 56 time_t tv = static_cast<time_t>(std::floor(time/msPerSecond));
57 struct tm* t = localtime(&tv); 57 struct tm* t = localtime(&tv);
58 if (NULL == t) return ""; 58 if (NULL == t) return "";
59 return tzname[0]; // The location of the timezone string on Cygwin. 59 return tzname[0]; // The location of the timezone string on Cygwin.
60 } 60 }
61 61
62 62
63 double OS::LocalTimeOffset() { 63 double OS::LocalTimeOffset(TimezoneCache* cache) {
64 // On Cygwin, struct tm does not contain a tm_gmtoff field. 64 // On Cygwin, struct tm does not contain a tm_gmtoff field.
65 time_t utc = time(NULL); 65 time_t utc = time(NULL);
66 ASSERT(utc != -1); 66 ASSERT(utc != -1);
67 struct tm* loc = localtime(&utc); 67 struct tm* loc = localtime(&utc);
68 ASSERT(loc != NULL); 68 ASSERT(loc != NULL);
69 // time - localtime includes any daylight savings offset, so subtract it. 69 // time - localtime includes any daylight savings offset, so subtract it.
70 return static_cast<double>((mktime(loc) - utc) * msPerSecond - 70 return static_cast<double>((mktime(loc) - utc) * msPerSecond -
71 (loc->tm_isdst > 0 ? 3600 * msPerSecond : 0)); 71 (loc->tm_isdst > 0 ? 3600 * msPerSecond : 0));
72 } 72 }
73 73
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 return VirtualFree(base, 0, MEM_RELEASE) != 0; 348 return VirtualFree(base, 0, MEM_RELEASE) != 0;
349 } 349 }
350 350
351 351
352 bool VirtualMemory::HasLazyCommits() { 352 bool VirtualMemory::HasLazyCommits() {
353 // TODO(alph): implement for the platform. 353 // TODO(alph): implement for the platform.
354 return false; 354 return false;
355 } 355 }
356 356
357 } } // namespace v8::internal 357 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform.h ('k') | src/platform-freebsd.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698