about summary refs log tree commit diff
path: root/absl/time
diff options
context:
space:
mode:
Diffstat (limited to 'absl/time')
-rw-r--r--absl/time/BUILD.bazel5
-rw-r--r--absl/time/format_test.cc6
-rw-r--r--absl/time/internal/test_util.cc5
-rw-r--r--absl/time/time.h4
4 files changed, 12 insertions, 8 deletions
diff --git a/absl/time/BUILD.bazel b/absl/time/BUILD.bazel
index 0d340f25ca3c..c34f52489c0d 100644
--- a/absl/time/BUILD.bazel
+++ b/absl/time/BUILD.bazel
@@ -19,10 +19,6 @@ load(
     "ABSL_DEFAULT_COPTS",
     "ABSL_TEST_COPTS",
 )
-load(
-    "//absl:test_dependencies.bzl",
-    "GUNIT_MAIN_DEPS_SELECTOR",
-)
 
 package(default_visibility = ["//visibility:public"])
 
@@ -85,7 +81,6 @@ cc_test(
         "no_test_android_x86",
         "no_test_ios_x86_64",
         "no_test_loonix",
-        "no_test_msvc_x64",
     ],
     deps = [
         ":test_util",
diff --git a/absl/time/format_test.cc b/absl/time/format_test.cc
index b139ff6f1b99..09d1fe66667d 100644
--- a/absl/time/format_test.cc
+++ b/absl/time/format_test.cc
@@ -392,6 +392,11 @@ TEST(FormatParse, RoundTrip) {
     EXPECT_EQ(in, out);  // RFC1123_full includes %z
   }
 
+  // `absl::FormatTime()` falls back to strftime() for "%c", which appears to
+  // work. On Windows, `absl::ParseTime()` falls back to std::get_time() which
+  // appears to fail on "%c" (or at least on the "%c" text produced by
+  // `strftime()`). This makes it fail the round-trip test.
+#ifndef _MSC_VER
   // Even though we don't know what %c will produce, it should roundtrip,
   // but only in the 0-offset timezone.
   {
@@ -400,6 +405,7 @@ TEST(FormatParse, RoundTrip) {
     EXPECT_TRUE(absl::ParseTime("%c", s, &out, &err)) << s << ": " << err;
     EXPECT_EQ(in, out);
   }
+#endif  // _MSC_VER
 }
 
 TEST(FormatParse, RoundTripDistantFuture) {
diff --git a/absl/time/internal/test_util.cc b/absl/time/internal/test_util.cc
index 21d5f2a66393..1a415f89469e 100644
--- a/absl/time/internal/test_util.cc
+++ b/absl/time/internal/test_util.cc
@@ -64,8 +64,13 @@ const struct ZoneInfo {
      reinterpret_cast<char*>(America_Los_Angeles), America_Los_Angeles_len},
 
     // Allows use of the local time zone from a common system-specific location.
+#ifdef _MSC_VER
+    {"localtime",  //
+     reinterpret_cast<char*>(America_Los_Angeles), America_Los_Angeles_len},
+#else
     {"/etc/localtime",  //
      reinterpret_cast<char*>(America_Los_Angeles), America_Los_Angeles_len},
+#endif
 };
 
 class TestZoneInfoSource : public cctz::ZoneInfoSource {
diff --git a/absl/time/time.h b/absl/time/time.h
index 6976343708be..b0ebf6ee8e53 100644
--- a/absl/time/time.h
+++ b/absl/time/time.h
@@ -992,8 +992,7 @@ bool ParseTime(const std::string& format, const std::string& input, TimeZone tz,
 //   --start_time=2016-01-02T03:04:05.678+08:00
 //
 // Note: A UTC offset (or 'Z' indicating a zero-offset from UTC) is required.
-// If your application doesn't have a UTC offset to specify, perhaps you're
-// really specifying a Civil Time
+//
 // Additionally, if you'd like to specify a time as a count of
 // seconds/milliseconds/etc from the Unix epoch, use a absl::Duration flag and
 // add that duration to absl::UnixEpoch() to get a absl::Time.
@@ -1026,7 +1025,6 @@ std::string UnparseFlag(Time t);
 // - https://github.com/google/cctz
 // - http://www.iana.org/time-zones
 // - http://en.wikipedia.org/wiki/Zoneinfo
-//   TimeZone backing data with your binary.
 class TimeZone {
  public:
   explicit TimeZone(cctz::time_zone tz) : cz_(tz) {}