diff options
Diffstat (limited to 'src/google/protobuf/util/time_util.cc')
-rw-r--r-- | src/google/protobuf/util/time_util.cc | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/src/google/protobuf/util/time_util.cc b/src/google/protobuf/util/time_util.cc index 82f1f4fb..46a6f5a8 100644 --- a/src/google/protobuf/util/time_util.cc +++ b/src/google/protobuf/util/time_util.cc @@ -374,19 +374,6 @@ namespace { using google::protobuf::util::kNanosPerSecond; using google::protobuf::util::CreateNormalized; -// Convert a Timestamp to uint128. -void ToUint128(const Timestamp& value, uint128* result, bool* negative) { - if (value.seconds() < 0) { - *negative = true; - *result = static_cast<uint64>(-value.seconds()); - *result = *result * kNanosPerSecond - static_cast<uint32>(value.nanos()); - } else { - *negative = false; - *result = static_cast<uint64>(value.seconds()); - *result = *result * kNanosPerSecond + static_cast<uint32>(value.nanos()); - } -} - // Convert a Duration to uint128. void ToUint128(const Duration& value, uint128* result, bool* negative) { if (value.seconds() < 0 || value.nanos() < 0) { @@ -400,21 +387,6 @@ void ToUint128(const Duration& value, uint128* result, bool* negative) { } } -void ToTimestamp(const uint128& value, bool negative, Timestamp* timestamp) { - int64 seconds = static_cast<int64>(Uint128Low64(value / kNanosPerSecond)); - int32 nanos = static_cast<int32>(Uint128Low64(value % kNanosPerSecond)); - if (negative) { - seconds = -seconds; - nanos = -nanos; - if (nanos < 0) { - nanos += kNanosPerSecond; - seconds -= 1; - } - } - timestamp->set_seconds(seconds); - timestamp->set_nanos(nanos); -} - void ToDuration(const uint128& value, bool negative, Duration* duration) { int64 seconds = static_cast<int64>(Uint128Low64(value / kNanosPerSecond)); int32 nanos = static_cast<int32>(Uint128Low64(value % kNanosPerSecond)); |