summaryrefslogtreecommitdiffstats
path: root/ipc/chromium/src/base/time_posix.cc
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2019-11-02 14:37:22 +0100
committerGitHub <noreply@github.com>2019-11-02 14:37:22 +0100
commit21b3f6247403c06f85e1f45d219f87549862198f (patch)
tree0038ae92f1cc7aaff0b55d6e5ac59efcc28bdf8f /ipc/chromium/src/base/time_posix.cc
parentff881bdb6795e0f307b93919f98f454bedde4bb6 (diff)
parenta9dc528a4a7b0aaad5308aff70963485ec3e9bec (diff)
downloadUXP-21b3f6247403c06f85e1f45d219f87549862198f.tar
UXP-21b3f6247403c06f85e1f45d219f87549862198f.tar.gz
UXP-21b3f6247403c06f85e1f45d219f87549862198f.tar.lz
UXP-21b3f6247403c06f85e1f45d219f87549862198f.tar.xz
UXP-21b3f6247403c06f85e1f45d219f87549862198f.zip
Merge pull request #1262 from athenian200/solaris-work
Support Modern Solaris
Diffstat (limited to 'ipc/chromium/src/base/time_posix.cc')
-rw-r--r--ipc/chromium/src/base/time_posix.cc29
1 files changed, 27 insertions, 2 deletions
diff --git a/ipc/chromium/src/base/time_posix.cc b/ipc/chromium/src/base/time_posix.cc
index 2eb76a989..5e0a922d9 100644
--- a/ipc/chromium/src/base/time_posix.cc
+++ b/ipc/chromium/src/base/time_posix.cc
@@ -67,11 +67,13 @@ Time Time::FromExploded(bool is_local, const Exploded& exploded) {
timestruct.tm_wday = exploded.day_of_week; // mktime/timegm ignore this
timestruct.tm_yday = 0; // mktime/timegm ignore this
timestruct.tm_isdst = -1; // attempt to figure it out
+#ifndef OS_SOLARIS
timestruct.tm_gmtoff = 0; // not a POSIX field, so mktime/timegm ignore
timestruct.tm_zone = NULL; // not a POSIX field, so mktime/timegm ignore
+#endif
time_t seconds;
-#ifdef ANDROID
+#if defined(ANDROID) || defined(OS_SOLARIS)
seconds = mktime(&timestruct);
#else
if (is_local)
@@ -175,7 +177,7 @@ TimeTicks TimeTicks::Now() {
// With numer and denom = 1 (the expected case), the 64-bit absolute time
// reported in nanoseconds is enough to last nearly 585 years.
-#elif defined(OS_OPENBSD) || defined(OS_POSIX) && \
+#elif defined(OS_OPENBSD) || defined(OS_SOLARIS) || defined(OS_POSIX) && \
defined(_POSIX_MONOTONIC_CLOCK) && _POSIX_MONOTONIC_CLOCK >= 0
struct timespec ts;
@@ -200,4 +202,27 @@ TimeTicks TimeTicks::HighResNow() {
return Now();
}
+#ifdef OS_SOLARIS
+struct timespec TimeDelta::ToTimeSpec() const {
+ int64_t microseconds = InMicroseconds();
+ time_t seconds = 0;
+ if (microseconds >= Time::kMicrosecondsPerSecond) {
+ seconds = InSeconds();
+ microseconds -= seconds * Time::kMicrosecondsPerSecond;
+ }
+ struct timespec result =
+ {seconds,
+ microseconds * Time::kNanosecondsPerMicrosecond};
+ return result;
+}
+
+struct timeval Time::ToTimeVal() const {
+ struct timeval result;
+ int64_t us = us_ - kTimeTToMicrosecondsOffset;
+ result.tv_sec = us / Time::kMicrosecondsPerSecond;
+ result.tv_usec = us % Time::kMicrosecondsPerSecond;
+ return result;
+}
+#endif
+
} // namespace base