From 4105ebb6ed85aaffec5e4469a939945fb9eea066 Mon Sep 17 00:00:00 2001 From: athenian200 Date: Tue, 1 Oct 2019 18:28:10 -0500 Subject: MoonchildProductions#1251 - Part 4: Core build system changes, lots of libevent/IPC junk. This is mostly ifdefs, but as you can see, Solaris is actually a lot like Linux. They're both more SysV than BSD at core, and most of the differences have more to do with Solaris not using glibc than anything else. I still need to audit a lot of these changes and understand why they're needed and what the alternative approaches are. After this patch, most of the core functionality needed to build Solaris is here. --- ipc/chromium/src/base/time_posix.cc | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'ipc/chromium/src/base/time_posix.cc') diff --git a/ipc/chromium/src/base/time_posix.cc b/ipc/chromium/src/base/time_posix.cc index 2eb76a989..419cc8afb 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(×truct); #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(); } +#if defined(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 -- cgit v1.2.3 From 687a798e6dedacb8b42826debcd8e89baa69ce94 Mon Sep 17 00:00:00 2001 From: athenian200 Date: Sat, 19 Oct 2019 14:24:49 -0500 Subject: MoonchildProductions#1251 - Part 27: Fix ifdef style. This should do it for all the commits to files I changed, but while I'm in here I could probably go ahead and turn ALL the singular if defined statements into ifdef statements by using grep/find on the tree. On the other hand, perhaps we should do that as a separate issue so that this doesn't become a case of scope creep. --- ipc/chromium/src/base/time_posix.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ipc/chromium/src/base/time_posix.cc') diff --git a/ipc/chromium/src/base/time_posix.cc b/ipc/chromium/src/base/time_posix.cc index 419cc8afb..5e0a922d9 100644 --- a/ipc/chromium/src/base/time_posix.cc +++ b/ipc/chromium/src/base/time_posix.cc @@ -202,7 +202,7 @@ TimeTicks TimeTicks::HighResNow() { return Now(); } -#if defined(OS_SOLARIS) +#ifdef OS_SOLARIS struct timespec TimeDelta::ToTimeSpec() const { int64_t microseconds = InMicroseconds(); time_t seconds = 0; -- cgit v1.2.3