V8 Project
v8::base::TimezoneCache Class Reference
+ Collaboration diagram for v8::base::TimezoneCache:

Public Member Functions

 TimezoneCache ()
 
void Clear ()
 
void InitializeIfNeeded ()
 
const char * GuessTimezoneNameFromBias (int bias)
 

Private Attributes

bool initialized_
 
char std_tz_name_ [kTzNameSize]
 
char dst_tz_name_ [kTzNameSize]
 
TIME_ZONE_INFORMATION tzinfo_
 

Static Private Attributes

static const int kTzNameSize = 128
 

Friends

class Win32Time
 

Detailed Description

Definition at line 292 of file platform-posix.cc.

Constructor & Destructor Documentation

◆ TimezoneCache()

v8::base::TimezoneCache::TimezoneCache ( )
inline

Definition at line 119 of file platform-win32.cc.

119 : initialized_(false) { }

Member Function Documentation

◆ Clear()

void v8::base::TimezoneCache::Clear ( )
inline

Definition at line 121 of file platform-win32.cc.

121  {
122  initialized_ = false;
123  }

References initialized_.

◆ GuessTimezoneNameFromBias()

const char* v8::base::TimezoneCache::GuessTimezoneNameFromBias ( int  bias)
inline

Definition at line 176 of file platform-win32.cc.

176  {
177  static const int kHour = 60;
178  switch (-bias) {
179  case -9*kHour: return "Alaska";
180  case -8*kHour: return "Pacific";
181  case -7*kHour: return "Mountain";
182  case -6*kHour: return "Central";
183  case -5*kHour: return "Eastern";
184  case -4*kHour: return "Atlantic";
185  case 0*kHour: return "GMT";
186  case +1*kHour: return "Central Europe";
187  case +2*kHour: return "Eastern Europe";
188  case +3*kHour: return "Russia";
189  case +5*kHour + 30: return "India";
190  case +8*kHour: return "China";
191  case +9*kHour: return "Japan";
192  case +12*kHour: return "New Zealand";
193  default: return "Local";
194  }
195  }

Referenced by InitializeIfNeeded().

+ Here is the caller graph for this function:

◆ InitializeIfNeeded()

void v8::base::TimezoneCache::InitializeIfNeeded ( )
inline

Definition at line 127 of file platform-win32.cc.

127  {
128  // Just return if timezone information has already been initialized.
129  if (initialized_) return;
130 
131  // Initialize POSIX time zone data.
132  _tzset();
133  // Obtain timezone information from operating system.
134  memset(&tzinfo_, 0, sizeof(tzinfo_));
135  if (GetTimeZoneInformation(&tzinfo_) == TIME_ZONE_ID_INVALID) {
136  // If we cannot get timezone information we fall back to CET.
137  tzinfo_.Bias = -60;
138  tzinfo_.StandardDate.wMonth = 10;
139  tzinfo_.StandardDate.wDay = 5;
140  tzinfo_.StandardDate.wHour = 3;
141  tzinfo_.StandardBias = 0;
142  tzinfo_.DaylightDate.wMonth = 3;
143  tzinfo_.DaylightDate.wDay = 5;
144  tzinfo_.DaylightDate.wHour = 2;
145  tzinfo_.DaylightBias = -60;
146  }
147 
148  // Make standard and DST timezone names.
149  WideCharToMultiByte(CP_UTF8, 0, tzinfo_.StandardName, -1,
151  std_tz_name_[kTzNameSize - 1] = '\0';
152  WideCharToMultiByte(CP_UTF8, 0, tzinfo_.DaylightName, -1,
154  dst_tz_name_[kTzNameSize - 1] = '\0';
155 
156  // If OS returned empty string or resource id (like "@tzres.dll,-211")
157  // simply guess the name from the UTC bias of the timezone.
158  // To properly resolve the resource identifier requires a library load,
159  // which is not possible in a sandbox.
160  if (std_tz_name_[0] == '\0' || std_tz_name_[0] == '@') {
162  "%s Standard Time",
164  }
165  if (dst_tz_name_[0] == '\0' || dst_tz_name_[0] == '@') {
167  "%s Daylight Time",
169  }
170  // Timezone information initialized.
171  initialized_ = true;
172  }
static int SNPrintF(char *str, int length, const char *format,...)
char std_tz_name_[kTzNameSize]
char dst_tz_name_[kTzNameSize]
static const int kTzNameSize
const char * GuessTimezoneNameFromBias(int bias)
TIME_ZONE_INFORMATION tzinfo_
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL

References dst_tz_name_, GuessTimezoneNameFromBias(), initialized_, kTzNameSize, NULL, v8::base::OS::SNPrintF(), std_tz_name_, and tzinfo_.

Referenced by v8::base::Win32Time::InDST(), and v8::base::Win32Time::LocalOffset().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Friends And Related Function Documentation

◆ Win32Time

friend class Win32Time
friend

Definition at line 204 of file platform-win32.cc.

Member Data Documentation

◆ dst_tz_name_

char v8::base::TimezoneCache::dst_tz_name_[kTzNameSize]
private

Definition at line 202 of file platform-win32.cc.

Referenced by InitializeIfNeeded(), and v8::base::Win32Time::LocalTimezone().

◆ initialized_

bool v8::base::TimezoneCache::initialized_
private

Definition at line 200 of file platform-win32.cc.

Referenced by Clear(), and InitializeIfNeeded().

◆ kTzNameSize

const int v8::base::TimezoneCache::kTzNameSize = 128
staticprivate

Definition at line 199 of file platform-win32.cc.

Referenced by InitializeIfNeeded().

◆ std_tz_name_

char v8::base::TimezoneCache::std_tz_name_[kTzNameSize]
private

Definition at line 201 of file platform-win32.cc.

Referenced by InitializeIfNeeded(), and v8::base::Win32Time::LocalTimezone().

◆ tzinfo_

TIME_ZONE_INFORMATION v8::base::TimezoneCache::tzinfo_
private

The documentation for this class was generated from the following files: