File tree Expand file tree Collapse file tree 12 files changed +88
-30
lines changed Expand file tree Collapse file tree 12 files changed +88
-30
lines changed Original file line number Diff line number Diff line change @@ -2507,6 +2507,8 @@ v8_component("v8_libbase") {
2507
2507
2508
2508
if (is_posix ) {
2509
2509
sources += [
2510
+ " src/base/platform/platform-posix-time.cc" ,
2511
+ " src/base/platform/platform-posix-time.h" ,
2510
2512
" src/base/platform/platform-posix.cc" ,
2511
2513
" src/base/platform/platform-posix.h" ,
2512
2514
]
Original file line number Diff line number Diff line change 10
10
// system so their names cannot be changed without changing the scripts.
11
11
#define V8_MAJOR_VERSION 6
12
12
#define V8_MINOR_VERSION 0
13
- #define V8_BUILD_NUMBER 286
14
- #define V8_PATCH_LEVEL 52
13
+ #define V8_BUILD_NUMBER 287
14
+ #define V8_PATCH_LEVEL 53
15
15
16
16
// Use 1 for candidates and 0 otherwise.
17
17
// (Boolean macro values are not supported by all preprocessors.)
Original file line number Diff line number Diff line change 29
29
#undef MAP_TYPE
30
30
31
31
#include " src/base/macros.h"
32
+ #include " src/base/platform/platform-posix-time.h"
32
33
#include " src/base/platform/platform-posix.h"
33
34
#include " src/base/platform/platform.h"
34
35
35
36
namespace v8 {
36
37
namespace base {
37
38
38
- TimezoneCache* OS::CreateTimezoneCache () { return new PosixTimezoneCache (); }
39
+ TimezoneCache* OS::CreateTimezoneCache () {
40
+ return new PosixDefaultTimezoneCache ();
41
+ }
39
42
40
43
void * OS::Allocate (const size_t requested, size_t * allocated,
41
44
OS::MemoryPermission access) {
Original file line number Diff line number Diff line change 44
44
#undef MAP_TYPE
45
45
46
46
#include " src/base/macros.h"
47
+ #include " src/base/platform/platform-posix-time.h"
47
48
#include " src/base/platform/platform-posix.h"
48
49
#include " src/base/platform/platform.h"
49
50
@@ -92,7 +93,9 @@ bool OS::ArmUsingHardFloat() {
92
93
93
94
#endif // def __arm__
94
95
95
- TimezoneCache* OS::CreateTimezoneCache () { return new PosixTimezoneCache (); }
96
+ TimezoneCache* OS::CreateTimezoneCache () {
97
+ return new PosixDefaultTimezoneCache ();
98
+ }
96
99
97
100
void * OS::Allocate (const size_t requested, size_t * allocated,
98
101
OS::MemoryPermission access) {
Original file line number Diff line number Diff line change 36
36
#undef MAP_TYPE
37
37
38
38
#include " src/base/macros.h"
39
+ #include " src/base/platform/platform-posix-time.h"
39
40
#include " src/base/platform/platform-posix.h"
40
41
#include " src/base/platform/platform.h"
41
42
42
-
43
43
namespace v8 {
44
44
namespace base {
45
45
@@ -97,7 +97,9 @@ std::vector<OS::SharedLibraryAddress> OS::GetSharedLibraryAddresses() {
97
97
void OS::SignalCodeMovingGC () {
98
98
}
99
99
100
- TimezoneCache* OS::CreateTimezoneCache () { return new PosixTimezoneCache (); }
100
+ TimezoneCache* OS::CreateTimezoneCache () {
101
+ return new PosixDefaultTimezoneCache ();
102
+ }
101
103
102
104
VirtualMemory::VirtualMemory () : address_(NULL ), size_(0 ) { }
103
105
Original file line number Diff line number Diff line change 27
27
#undef MAP_TYPE
28
28
29
29
#include " src/base/macros.h"
30
+ #include " src/base/platform/platform-posix-time.h"
30
31
#include " src/base/platform/platform-posix.h"
31
32
#include " src/base/platform/platform.h"
32
33
33
34
namespace v8 {
34
35
namespace base {
35
36
36
- TimezoneCache* OS::CreateTimezoneCache () { return new PosixTimezoneCache (); }
37
+ TimezoneCache* OS::CreateTimezoneCache () {
38
+ return new PosixDefaultTimezoneCache ();
39
+ }
37
40
38
41
void * OS::Allocate (const size_t requested, size_t * allocated,
39
42
OS::MemoryPermission access) {
Original file line number Diff line number Diff line change
1
+ // Copyright 2017 the V8 project authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+
5
+ #include < cmath>
6
+
7
+ #include " src/base/platform/platform-posix-time.h"
8
+
9
+ namespace v8 {
10
+ namespace base {
11
+
12
+ const char * PosixDefaultTimezoneCache::LocalTimezone (double time) {
13
+ if (std::isnan (time)) return " " ;
14
+ time_t tv = static_cast <time_t >(std::floor (time / msPerSecond));
15
+ struct tm tm;
16
+ struct tm * t = localtime_r (&tv, &tm);
17
+ if (!t || !t->tm_zone ) return " " ;
18
+ return t->tm_zone ;
19
+ }
20
+
21
+ double PosixDefaultTimezoneCache::LocalTimeOffset () {
22
+ time_t tv = time (NULL );
23
+ struct tm tm;
24
+ struct tm * t = localtime_r (&tv, &tm);
25
+ // tm_gmtoff includes any daylight savings offset, so subtract it.
26
+ return static_cast <double >(t->tm_gmtoff * msPerSecond -
27
+ (t->tm_isdst > 0 ? 3600 * msPerSecond : 0 ));
28
+ }
29
+
30
+ } // namespace base
31
+ } // namespace v8
Original file line number Diff line number Diff line change
1
+ // Copyright 2017 the V8 project authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+
5
+ #include " src/base/platform/platform-posix.h"
6
+
7
+ namespace v8 {
8
+ namespace base {
9
+
10
+ class PosixDefaultTimezoneCache : public PosixTimezoneCache {
11
+ public:
12
+ const char * LocalTimezone (double time_ms) override ;
13
+ double LocalTimeOffset () override ;
14
+
15
+ ~PosixDefaultTimezoneCache () override {}
16
+ };
17
+
18
+ } // namespace base
19
+ } // namespace v8
Original file line number Diff line number Diff line change @@ -388,26 +388,6 @@ double OS::TimeCurrentMillis() {
388
388
return Time::Now ().ToJsTime ();
389
389
}
390
390
391
- #if !V8_OS_AIX && !V8_OS_SOLARIS && !V8_OS_CYGWIN
392
- const char * PosixTimezoneCache::LocalTimezone (double time) {
393
- if (std::isnan (time)) return " " ;
394
- time_t tv = static_cast <time_t >(std::floor (time / msPerSecond));
395
- struct tm tm;
396
- struct tm * t = localtime_r (&tv, &tm);
397
- if (!t || !t->tm_zone ) return " " ;
398
- return t->tm_zone ;
399
- }
400
-
401
- double PosixTimezoneCache::LocalTimeOffset () {
402
- time_t tv = time (NULL );
403
- struct tm tm;
404
- struct tm * t = localtime_r (&tv, &tm);
405
- // tm_gmtoff includes any daylight savings offset, so subtract it.
406
- return static_cast <double >(t->tm_gmtoff * msPerSecond -
407
- (t->tm_isdst > 0 ? 3600 * msPerSecond : 0 ));
408
- }
409
- #endif
410
-
411
391
double PosixTimezoneCache::DaylightSavingsOffset (double time) {
412
392
if (std::isnan (time)) return std::numeric_limits<double >::quiet_NaN ();
413
393
time_t tv = static_cast <time_t >(std::floor (time/msPerSecond));
Original file line number Diff line number Diff line change @@ -13,9 +13,7 @@ namespace base {
13
13
14
14
class PosixTimezoneCache : public TimezoneCache {
15
15
public:
16
- const char * LocalTimezone (double time_ms) override ;
17
16
double DaylightSavingsOffset (double time_ms) override ;
18
- double LocalTimeOffset () override ;
19
17
void Clear () override {}
20
18
~PosixTimezoneCache () override {}
21
19
You can’t perform that action at this time.
0 commit comments