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

Side by Side Diff: src/date.h

Issue 9652030: Fix compile errors on Windows introduced by r10983. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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 | « no previous file | src/objects.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 44
45 // The largest time that can be passed to OS date-time library functions. 45 // The largest time that can be passed to OS date-time library functions.
46 static const int kMaxEpochTimeInSec = kMaxInt; 46 static const int kMaxEpochTimeInSec = kMaxInt;
47 static const int64_t kMaxEpochTimeInMs = 47 static const int64_t kMaxEpochTimeInMs =
48 static_cast<int64_t>(kMaxInt) * 1000; 48 static_cast<int64_t>(kMaxInt) * 1000;
49 49
50 // The largest time that can be stored in JSDate. 50 // The largest time that can be stored in JSDate.
51 static const int64_t kMaxTimeInMs = 51 static const int64_t kMaxTimeInMs =
52 static_cast<int64_t>(864000000) * 10000000; 52 static_cast<int64_t>(864000000) * 10000000;
53 53
54 // Conservative upper bound on time that can be stored in JSDate
55 // before UTC conversion.
56 static const int64_t kMaxTimeBeforeUTCInMs =
57 kMaxTimeInMs + 10 * kMsPerDay;
58
54 // Sentinel that denotes an invalid local offset. 59 // Sentinel that denotes an invalid local offset.
55 static const int kInvalidLocalOffsetInMs = kMaxInt; 60 static const int kInvalidLocalOffsetInMs = kMaxInt;
56 // Sentinel that denotes an invalid cache stamp. 61 // Sentinel that denotes an invalid cache stamp.
57 // It is an invariant of DateCache that cache stamp is non-negative. 62 // It is an invariant of DateCache that cache stamp is non-negative.
58 static const int kInvalidStamp = -1; 63 static const int kInvalidStamp = -1;
59 64
60 DateCache() : stamp_(0) { 65 DateCache() : stamp_(0) {
61 ResetDateCache(); 66 ResetDateCache();
62 } 67 }
63 68
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 174
170 // Cache stamp is used for invalidating caches in JSDate. 175 // Cache stamp is used for invalidating caches in JSDate.
171 // We increment the stamp each time when the timezone information changes. 176 // We increment the stamp each time when the timezone information changes.
172 // JSDate objects perform stamp check and invalidate their caches if 177 // JSDate objects perform stamp check and invalidate their caches if
173 // their saved stamp is not equal to the current stamp. 178 // their saved stamp is not equal to the current stamp.
174 Smi* stamp() { return stamp_; } 179 Smi* stamp() { return stamp_; }
175 void* stamp_address() { return &stamp_; } 180 void* stamp_address() { return &stamp_; }
176 181
177 // These functions are virtual so that we can override them when testing. 182 // These functions are virtual so that we can override them when testing.
178 virtual int GetDaylightSavingsOffsetFromOS(int64_t time_sec) { 183 virtual int GetDaylightSavingsOffsetFromOS(int64_t time_sec) {
179 return static_cast<int>(OS::DaylightSavingsOffset(time_sec * 1000)); 184 double time_ms = static_cast<double>(time_sec * 1000);
185 return static_cast<int>(OS::DaylightSavingsOffset(time_ms));
180 } 186 }
181 187
182 virtual int GetLocalOffsetFromOS() { 188 virtual int GetLocalOffsetFromOS() {
183 double offset = OS::LocalTimeOffset(); 189 double offset = OS::LocalTimeOffset();
184 ASSERT(offset < kInvalidLocalOffsetInMs); 190 ASSERT(offset < kInvalidLocalOffsetInMs);
185 return static_cast<int>(offset); 191 return static_cast<int>(offset);
186 } 192 }
187 193
188 private: 194 private:
189 // The implementation relies on the fact that no time zones have 195 // The implementation relies on the fact that no time zones have
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 bool ymd_valid_; 251 bool ymd_valid_;
246 int ymd_days_; 252 int ymd_days_;
247 int ymd_year_; 253 int ymd_year_;
248 int ymd_month_; 254 int ymd_month_;
249 int ymd_day_; 255 int ymd_day_;
250 }; 256 };
251 257
252 } } // namespace v8::internal 258 } } // namespace v8::internal
253 259
254 #endif 260 #endif
OLDNEW
« no previous file with comments | « no previous file | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698