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

Unified Diff: src/base/platform/platform-cygwin.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-aix.cc ('k') | src/base/platform/platform-freebsd.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/base/platform/platform-cygwin.cc
diff --git a/src/base/platform/platform-cygwin.cc b/src/base/platform/platform-cygwin.cc
index ba0f45667f333ce6df54d5b9dcaa63d0b1ac5fb3..d0c1a9eb0763c9e163e5b88b864b0e193c3ed57f 100644
--- a/src/base/platform/platform-cygwin.cc
+++ b/src/base/platform/platform-cygwin.cc
@@ -19,14 +19,22 @@
#undef MAP_TYPE
#include "src/base/macros.h"
+#include "src/base/platform/platform-posix.h"
#include "src/base/platform/platform.h"
#include "src/base/win32-headers.h"
namespace v8 {
namespace base {
+class CygwinTimezoneCache : public PosixTimezoneCache {
+ const char* LocalTimezone(double time) override;
-const char* OS::LocalTimezone(double time, TimezoneCache* cache) {
+ double LocalTimeOffset() override;
+
+ ~CygwinTimezoneCache() override {}
+};
+
+const char* CygwinTimezoneCache::LocalTimezone(double time) {
if (std::isnan(time)) return "";
time_t tv = static_cast<time_t>(std::floor(time/msPerSecond));
struct tm tm;
@@ -35,8 +43,7 @@ const char* OS::LocalTimezone(double time, TimezoneCache* cache) {
return tzname[0]; // The location of the timezone string on Cygwin.
}
-
-double OS::LocalTimeOffset(TimezoneCache* cache) {
+double CygwinTimezoneCache::LocalTimeOffset() {
// On Cygwin, struct tm does not contain a tm_gmtoff field.
time_t utc = time(NULL);
DCHECK(utc != -1);
« no previous file with comments | « src/base/platform/platform-aix.cc ('k') | src/base/platform/platform-freebsd.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698