Limit dependencies in time.{cc,h} and time_win.cc

We remove the definition of LiveTicks::Now from time.cc. This removes
a dependency on mincore.lib through time_win.cc.

We remove the definition of ThreadTicks::Now from time.cc. This removes
a dependency on platform_thread.h through time_win.cc.

We also remove specific functions from time.{cc,h} to avoid the need to
compile time_exploded_posix.cc. This removes a dependency on icu.
---
 base/time/time.cc     | 12 ++++++++++++
 base/time/time.h      |  2 ++
 base/time/time_win.cc |  4 ++++
 3 files changed, 18 insertions(+)

diff --git a/base/time/time.cc b/base/time/time.cc
index 723ece8a838b..b275bde2ae12 100644
--- a/base/time/time.cc
+++ b/base/time/time.cc
@@ -22,11 +22,13 @@ namespace base {
 
 namespace {
 
+#if !defined(MOZ_ZUCCHINI)
 const char kWeekdayName[7][4] = {"Sun", "Mon", "Tue", "Wed",
                                  "Thu", "Fri", "Sat"};
 
 const char kMonthName[12][4] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
                                 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
+#endif  // !defined(MOZ_ZUCCHINI)
 
 TimeTicks g_shared_time_ticks_at_unix_epoch;
 
@@ -43,11 +45,13 @@ std::atomic<TimeNowFunction> g_time_now_from_system_time_function{
 std::atomic<TimeTicksNowFunction> g_time_ticks_now_function{
     &subtle::TimeTicksNowIgnoringOverride};
 
+#if !defined(MOZ_ZUCCHINI)
 std::atomic<LiveTicksNowFunction> g_live_ticks_now_function{
     &subtle::LiveTicksNowIgnoringOverride};
 
 std::atomic<ThreadTicksNowFunction> g_thread_ticks_now_function{
     &subtle::ThreadTicksNowIgnoringOverride};
+#endif  // !defined(MOZ_ZUCCHINI)
 
 }  // namespace internal
 
@@ -102,6 +106,7 @@ Time Time::NowFromSystemTime() {
       std::memory_order_relaxed)();
 }
 
+#if !defined(MOZ_ZUCCHINI)
 Time Time::Midnight(bool is_local) const {
   Exploded exploded;
   Explode(is_local, &exploded);
@@ -131,6 +136,7 @@ Time Time::Midnight(bool is_local) const {
 #endif
   return out_time;
 }
+#endif  // !defined(MOZ_ZUCCHINI)
 
 // static
 bool Time::FromStringInternal(const char* time_string,
@@ -190,6 +196,7 @@ int64_t Time::ToRoundedDownMillisecondsSinceUnixEpoch() const {
   return millis - kEpochOffsetMillis - (submillis < 0);
 }
 
+#if !defined(MOZ_ZUCCHINI)
 std::ostream& operator<<(std::ostream& os, Time time) {
   Time::Exploded exploded;
   time.UTCExplode(&exploded);
@@ -203,6 +210,7 @@ std::ostream& operator<<(std::ostream& os, Time time) {
                             exploded.second,
                             exploded.millisecond);
 }
+#endif  // !defined(MOZ_ZUCCHINI)
 
 // TimeTicks ------------------------------------------------------------------
 
@@ -263,6 +271,7 @@ std::ostream& operator<<(std::ostream& os, TimeTicks time_ticks) {
   return os << as_time_delta.InMicroseconds() << " bogo-microseconds";
 }
 
+#if !defined(MOZ_ZUCCHINI)
 // LiveTicks ------------------------------------------------------------------
 
 // static
@@ -289,6 +298,7 @@ ThreadTicks ThreadTicks::Now() {
   return internal::g_thread_ticks_now_function.load(
       std::memory_order_relaxed)();
 }
+#endif  // !defined(MOZ_ZUCCHINI)
 
 std::ostream& operator<<(std::ostream& os, ThreadTicks thread_ticks) {
   const TimeDelta as_time_delta = thread_ticks - ThreadTicks();
@@ -309,6 +319,7 @@ bool Time::Exploded::HasValidValues() const {
   // clang-format on
 }
 
+#if !defined(MOZ_ZUCCHINI)
 std::string TimeFormatHTTP(base::Time time) {
   base::Time::Exploded exploded;
   time.UTCExplode(&exploded);
@@ -317,5 +328,6 @@ std::string TimeFormatHTTP(base::Time time) {
       exploded.day_of_month, kMonthName[exploded.month - 1], exploded.year,
       exploded.hour, exploded.minute, exploded.second);
 }
+#endif  // !defined(MOZ_ZUCCHINI)
 
 }  // namespace base
diff --git a/base/time/time.h b/base/time/time.h
index 42d812b3ab52..25dec5d11aa3 100644
--- a/base/time/time.h
+++ b/base/time/time.h
@@ -785,6 +785,7 @@ class BASE_EXPORT Time : public time_internal::TimeBase<Time> {
     return FromStringInternal(time_string, false, parsed_time);
   }
 
+#if !defined(MOZ_ZUCCHINI)
   // Fills the given |exploded| structure with either the local time or UTC from
   // this Time instance. If the conversion cannot be made, the output will be
   // assigned invalid values. Use Exploded::HasValidValues() to confirm a
@@ -803,6 +804,7 @@ class BASE_EXPORT Time : public time_internal::TimeBase<Time> {
   // either UTC or local time. It will represent midnight on that day.
   Time UTCMidnight() const { return Midnight(false); }
   Time LocalMidnight() const { return Midnight(true); }
+#endif  // !defined(MOZ_ZUCCHINI)
 
   // For legacy deserialization only. Converts an integer value representing
   // Time to a class. This may be used when deserializing a |Time| structure,
diff --git a/base/time/time_win.cc b/base/time/time_win.cc
index c6540592a5c1..2d9383455526 100644
--- a/base/time/time_win.cc
+++ b/base/time/time_win.cc
@@ -47,7 +47,9 @@
 #include "base/cpu.h"
 #include "base/notreached.h"
 #include "base/synchronization/lock.h"
+#if !defined(MOZ_ZUCCHINI)
 #include "base/threading/platform_thread.h"
+#endif  // !defined(MOZ_ZUCCHINI)
 #include "base/time/time_override.h"
 #include "build/build_config.h"
 
@@ -642,6 +644,7 @@ TimeTicks::Clock TimeTicks::GetClock() {
                             : Clock::WIN_ROLLOVER_PROTECTED_TIME_GET_TIME;
 }
 
+#if !defined(MOZ_ZUCCHINI)
 // LiveTicks ------------------------------------------------------------------
 
 namespace subtle {
@@ -697,6 +700,7 @@ ThreadTicks ThreadTicks::GetForThread(
 
   return ThreadTicks(us);
 }
+#endif  // !defined(MOZ_ZUCCHINI)
 
 // static
 bool ThreadTicks::IsSupportedWin() {
-- 
2.42.0.windows.2

