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

Unified Diff: src/base/platform/platform-solaris.cc

Issue 2731463003: [date] Refactor TimezoneCache to be separate from the OS (Closed)
Patch Set: Properly reference windows function Created 3 years, 10 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
« no previous file with comments | « src/base/platform/platform-qnx.cc ('k') | src/base/platform/platform-win32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/base/platform/platform-solaris.cc
diff --git a/src/base/platform/platform-solaris.cc b/src/base/platform/platform-solaris.cc
index 6783c6ba8922977e225581f0ce8d633f5601736c..d5cc658d73aab1de12325c72692a8c13534e42ed 100644
--- a/src/base/platform/platform-solaris.cc
+++ b/src/base/platform/platform-solaris.cc
@@ -28,14 +28,21 @@
#undef MAP_TYPE
#include "src/base/macros.h"
+#include "src/base/platform/platform-posix.h"
#include "src/base/platform/platform.h"
-
namespace v8 {
namespace base {
+class SolarisTimezoneCache : public PosixTimezoneCache {
+ const char* LocalTimezone(double time) override;
+
+ double LocalTimeOffset() override;
-const char* OS::LocalTimezone(double time, TimezoneCache* cache) {
+ ~SolarisTimezoneCache() override {}
+};
+
+const char* SolarisTimezoneCache::LocalTimezone(double time) {
if (std::isnan(time)) return "";
time_t tv = static_cast<time_t>(std::floor(time/msPerSecond));
struct tm tm;
@@ -44,12 +51,12 @@ const char* OS::LocalTimezone(double time, TimezoneCache* cache) {
return tzname[0]; // The location of the timezone string on Solaris.
}
-
-double OS::LocalTimeOffset(TimezoneCache* cache) {
+double SolarisTimezoneCache::LocalTimeOffset() {
tzset();
return -static_cast<double>(timezone * msPerSecond);
}
+TimezoneCache* OS::CreateTimezoneCache() { return new SolarisTimezoneCache(); }
void* OS::Allocate(const size_t requested,
size_t* allocated,
« no previous file with comments | « src/base/platform/platform-qnx.cc ('k') | src/base/platform/platform-win32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698