aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/util/time_util.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/google/protobuf/util/time_util.cc')
-rw-r--r--src/google/protobuf/util/time_util.cc30
1 files changed, 0 insertions, 30 deletions
diff --git a/src/google/protobuf/util/time_util.cc b/src/google/protobuf/util/time_util.cc
index b11f822a..46a6f5a8 100644
--- a/src/google/protobuf/util/time_util.cc
+++ b/src/google/protobuf/util/time_util.cc
@@ -49,11 +49,9 @@ static const int kNanosPerSecond = 1000000000;
static const int kMicrosPerSecond = 1000000;
static const int kMillisPerSecond = 1000;
static const int kNanosPerMillisecond = 1000000;
-static const int kMicrosPerMillisecond = 1000;
static const int kNanosPerMicrosecond = 1000;
static const int kSecondsPerMinute = 60; // Note that we ignore leap seconds.
static const int kSecondsPerHour = 3600;
-static const char kTimestampFormat[] = "%E4Y-%m-%dT%H:%M:%S";
template <typename T>
T CreateNormalized(int64 seconds, int64 nanos);
@@ -376,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) {
@@ -402,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));