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-aix.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.h ('k') | src/base/platform/platform-cygwin.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/base/platform/platform-aix.cc
diff --git a/src/base/platform/platform-aix.cc b/src/base/platform/platform-aix.cc
index 6d6adfb2cb1b19020921dbe5dde30d286bb4fe10..d659dadedd214eeb9220662b283f185e2044de74 100644
--- a/src/base/platform/platform-aix.cc
+++ b/src/base/platform/platform-aix.cc
@@ -29,9 +29,9 @@
#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 {
@@ -42,8 +42,15 @@ static inline void* mmapHelper(size_t len, int prot, int flags, int fildes,
return mmap(addr, len, prot, flags, fildes, off);
}
+class AIXTimezoneCache : public PosixTimezoneCache {
+ const char* LocalTimezone(double time) override;
+
+ double LocalTimeOffset() override;
-const char* OS::LocalTimezone(double time, TimezoneCache* cache) {
+ ~AIXTimezoneCache() override {}
+};
+
+const char* AIXTimezoneCache::LocalTimezone(double time) {
if (std::isnan(time)) return "";
time_t tv = static_cast<time_t>(floor(time / msPerSecond));
struct tm tm;
@@ -52,8 +59,7 @@ const char* OS::LocalTimezone(double time, TimezoneCache* cache) {
return tzname[0]; // The location of the timezone string on AIX.
}
-
-double OS::LocalTimeOffset(TimezoneCache* cache) {
+double AIXTimezoneCache::LocalTimeOffset() {
// On AIX, struct tm does not contain a tm_gmtoff field.
time_t utc = time(NULL);
DCHECK(utc != -1);
@@ -63,6 +69,7 @@ double OS::LocalTimeOffset(TimezoneCache* cache) {
return static_cast<double>((mktime(loc) - utc) * msPerSecond);
}
+TimezoneCache* OS::CreateTimezoneCache() { return new AIXTimezoneCache(); }
void* OS::Allocate(const size_t requested, size_t* allocated, bool executable) {
const size_t msize = RoundUp(requested, getpagesize());
« no previous file with comments | « src/base/platform/platform.h ('k') | src/base/platform/platform-cygwin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698