summaryrefslogtreecommitdiff
path: root/absl/time/time.h
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2021-06-21 23:19:49 -0700
committerGravatar rogeeff <rogeeff@google.com>2021-06-22 04:45:20 -0400
commit4a23151e7ee089f54f0575f0a6d499e3a3fb6728 (patch)
tree5b8b325239ddae4123541621cb574091dcc4a34c /absl/time/time.h
parent60be12ed9822078970f05f3c560324184302df6b (diff)
Export of internal Abseil changes
-- f6d1ddef9a38e3fb8492181bf1a7a006b7f2145d by Abseil Team <absl-team@google.com>: Update the implementation of `operator<<` in Status to use `ToString(StatusToStringMode::kWithEverything)` PiperOrigin-RevId: 380740880 -- 5f13b20c4b85c1c6e94b69c74f80f8f3f3941747 by Derek Mauro <dmauro@google.com>: Update Docker images This also disables the Clang/libstdc++/C++20 combo as it seems that the latest libstdc++ is relying on C++20 Concepts to a greater extent than Clang supports. PiperOrigin-RevId: 380714572 -- f8f4dee12cfd02559bf741ad6b06f10ac0c48c73 by Abseil Team <absl-team@google.com>: Fix shadow member warnings in randen_hwaes.cc These happen when attempting to use abseil in github.com/google/benchmark. The project sets -Wshadow. The warning is due to the name of the Vector128 ctor parameter. Using v instead, which I see used elsewhere (e.g. line 290) PiperOrigin-RevId: 380704197 -- 2e1a09e9cb1239485715acb4828d9b4799fcfbb5 by Tom Manshreck <shreck@google.com>: Add more precise documentation for AbslParseFlag declarations in the Time API PiperOrigin-RevId: 380649107 -- 153e5f7a960c03e4161c03737a0ff18ba377ff73 by Evan Brown <ezb@google.com>: Make the number of control bytes a constant. We use a constexpr function because we need to support C++11, which doesn't have inline variables. The motivation is to avoid future bugs where the number changes and we forget to update all the places it's used. This CL should be a no-op. PiperOrigin-RevId: 380253975 GitOrigin-RevId: f6d1ddef9a38e3fb8492181bf1a7a006b7f2145d Change-Id: Id584138f898bf3ebef95fabcf48e41098c4db954
Diffstat (limited to 'absl/time/time.h')
-rw-r--r--absl/time/time.h28
1 files changed, 24 insertions, 4 deletions
diff --git a/absl/time/time.h b/absl/time/time.h
index 48982df4..7fa0f5c6 100644
--- a/absl/time/time.h
+++ b/absl/time/time.h
@@ -547,10 +547,20 @@ inline std::ostream& operator<<(std::ostream& os, Duration d) {
// `ZeroDuration()`. Parses "inf" and "-inf" as +/- `InfiniteDuration()`.
bool ParseDuration(absl::string_view dur_string, Duration* d);
-// Support for flag values of type Duration. Duration flags must be specified
-// in a format that is valid input for absl::ParseDuration().
+// AbslParseFlag()
+//
+// Parses a command-line flag string representation `text` into a a Duration
+// value. Duration flags must be specified in a format that is valid input for
+// `absl::ParseDuration()`.
bool AbslParseFlag(absl::string_view text, Duration* dst, std::string* error);
+
+
+// AbslUnparseFlag()
+//
+// Unparses a Duration value into a command-line string representation using
+// the format specified by `absl::ParseDuration()`.
std::string AbslUnparseFlag(Duration d);
+
ABSL_DEPRECATED("Use AbslParseFlag() instead.")
bool ParseFlag(const std::string& text, Duration* dst, std::string* error);
ABSL_DEPRECATED("Use AbslUnparseFlag() instead.")
@@ -813,8 +823,12 @@ Time FromChrono(const std::chrono::system_clock::time_point& tp);
// // tp == std::chrono::system_clock::from_time_t(123);
std::chrono::system_clock::time_point ToChronoTime(Time);
-// Support for flag values of type Time. Time flags must be specified in a
-// format that matches absl::RFC3339_full. For example:
+// AbslParseFlag()
+//
+// Parses the command-line flag string representation `text` into a Time value.
+// Time flags must be specified in a format that matches absl::RFC3339_full.
+//
+// For example:
//
// --start_time=2016-01-02T03:04:05.678+08:00
//
@@ -824,7 +838,13 @@ std::chrono::system_clock::time_point ToChronoTime(Time);
// seconds/milliseconds/etc from the Unix epoch, use an absl::Duration flag
// and add that duration to absl::UnixEpoch() to get an absl::Time.
bool AbslParseFlag(absl::string_view text, Time* t, std::string* error);
+
+// AbslUnparseFlag()
+//
+// Unparses a Time value into a command-line string representation using
+// the format specified by `absl::ParseTime()`.
std::string AbslUnparseFlag(Time t);
+
ABSL_DEPRECATED("Use AbslParseFlag() instead.")
bool ParseFlag(const std::string& text, Time* t, std::string* error);
ABSL_DEPRECATED("Use AbslUnparseFlag() instead.")