diff --git a/agent_based_epidemic_sim/port/deps/time_proto_util.cc b/agent_based_epidemic_sim/port/deps/time_proto_util.cc index 837f19c7..eb293e9d 100644 --- a/agent_based_epidemic_sim/port/deps/time_proto_util.cc +++ b/agent_based_epidemic_sim/port/deps/time_proto_util.cc @@ -66,8 +66,8 @@ absl::Status Validate(const google::protobuf::Timestamp& t) { absl::Status EncodeGoogleApiProto(absl::Duration d, google::protobuf::Duration* proto) { // s and n may both be negative, per the Duration proto spec. - const int64 s = absl::IDivDuration(d, absl::Seconds(1), &d); - const int64 n = absl::IDivDuration(d, absl::Nanoseconds(1), &d); + const int64_t s = absl::IDivDuration(d, absl::Seconds(1), &d); + const int64_t n = absl::IDivDuration(d, absl::Nanoseconds(1), &d); proto->set_seconds(s); proto->set_nanos(n); return Validate(*proto); @@ -75,7 +75,7 @@ absl::Status EncodeGoogleApiProto(absl::Duration d, absl::Status EncodeGoogleApiProto(absl::Time t, google::protobuf::Timestamp* proto) { - const int64 s = absl::ToUnixSeconds(t); + const int64_t s = absl::ToUnixSeconds(t); proto->set_seconds(s); proto->set_nanos((t - absl::FromUnixSeconds(s)) / absl::Nanoseconds(1)); return Validate(*proto); diff --git a/agent_based_epidemic_sim/port/deps/time_proto_util_test.cc b/agent_based_epidemic_sim/port/deps/time_proto_util_test.cc index c33553d3..e8e279b0 100644 --- a/agent_based_epidemic_sim/port/deps/time_proto_util_test.cc +++ b/agent_based_epidemic_sim/port/deps/time_proto_util_test.cc @@ -26,7 +26,7 @@ namespace abesim { -google::protobuf::Duration MakeGoogleApiDuration(int64 s, int32 ns) { +google::protobuf::Duration MakeGoogleApiDuration(int64_t s, int32_t ns) { google::protobuf::Duration proto; proto.set_seconds(s); proto.set_nanos(ns); @@ -77,7 +77,7 @@ inline absl::Time MakeGoogleApiTimeMin() { return absl::UnixEpoch() + absl::Seconds(-62135596800); } -google::protobuf::Timestamp MakeGoogleApiTimestamp(int64 s, int32 ns) { +google::protobuf::Timestamp MakeGoogleApiTimestamp(int64_t s, int32_t ns) { google::protobuf::Timestamp proto; proto.set_seconds(s); proto.set_nanos(ns); @@ -90,7 +90,7 @@ google::protobuf::Timestamp MakeGoogleApiTimestamp(int64 s, int32 ns) { // argument may be either a absl::Duration or a absl::Time. The template P // represents a google::protobuf::Duration or google::protobuf::Timestamp. template -void RoundTripGoogleApi(T v, int64 expected_sec, int32 expected_nsec) { +void RoundTripGoogleApi(T v, int64_t expected_sec, int32_t expected_nsec) { // auto status = EncodeGoogleApiProto(v, // const auto sor_proto = EncodeGoogleApiProto(v); // ASSERT_OK(sor_proto); @@ -133,13 +133,13 @@ void RoundTripGoogleApi(T v, int64 expected_sec, int32 expected_nsec) { TEST(ProtoUtilGoogleApi, RoundTripDuration) { // Shorthand to make the test cases readable. - const auto& s = [](int64 n) { return absl::Seconds(n); }; - const auto& ns = [](int64 n) { return absl::Nanoseconds(n); }; + const auto& s = [](int64_t n) { return absl::Seconds(n); }; + const auto& ns = [](int64_t n) { return absl::Nanoseconds(n); }; const struct { absl::Duration d; struct { - int64 sec; - int32 nsec; + int64_t sec; + int32_t nsec; } expected; } kTestCases[] = { {s(0), {0, 0}}, @@ -161,13 +161,13 @@ TEST(ProtoUtilGoogleApi, RoundTripDuration) { TEST(ProtoUtilGoogleApi, RoundTripTime) { // Shorthand to make the test cases readable. const absl::Time epoch = absl::UnixEpoch(); // The protobuf epoch. - const auto& s = [](int64 n) { return absl::Seconds(n); }; - const auto& ns = [](int64 n) { return absl::Nanoseconds(n); }; + const auto& s = [](int64_t n) { return absl::Seconds(n); }; + const auto& ns = [](int64_t n) { return absl::Nanoseconds(n); }; const struct { absl::Time t; struct { - int64 sec; - int32 nsec; + int64_t sec; + int32_t nsec; } expected; } kTestCases[] = { {epoch, {0, 0}}, @@ -194,8 +194,8 @@ TEST(ProtoUtilGoogleApi, TimeTruncTowardInfPast) { const struct { absl::Time t; struct { - int64 sec; - int32 nsec; + int64_t sec; + int32_t nsec; } expected; } kTestCases[] = { {before_epoch + tick, {-1234567890, 0}}, @@ -235,14 +235,14 @@ TEST(ProtoUtilGoogleApi, DecodeTimeError) { const google::protobuf::Timestamp kTestCases[] = { MakeGoogleApiTimestamp(1, -1), // MakeGoogleApiTimestamp(1, 999999999 + 1), // - MakeGoogleApiTimestamp(std::numeric_limits::lowest(), 0), - MakeGoogleApiTimestamp(std::numeric_limits::max(), 0), - MakeGoogleApiTimestamp(0, std::numeric_limits::lowest()), - MakeGoogleApiTimestamp(0, std::numeric_limits::max()), - MakeGoogleApiTimestamp(std::numeric_limits::lowest(), - std::numeric_limits::lowest()), - MakeGoogleApiTimestamp(std::numeric_limits::max(), - std::numeric_limits::max()), + MakeGoogleApiTimestamp(std::numeric_limits::lowest(), 0), + MakeGoogleApiTimestamp(std::numeric_limits::max(), 0), + MakeGoogleApiTimestamp(0, std::numeric_limits::lowest()), + MakeGoogleApiTimestamp(0, std::numeric_limits::max()), + MakeGoogleApiTimestamp(std::numeric_limits::lowest(), + std::numeric_limits::lowest()), + MakeGoogleApiTimestamp(std::numeric_limits::max(), + std::numeric_limits::max()), MakeGoogleApiTimestamp( ToUnixSeconds(MakeGoogleApiTimeMin() - absl::Seconds(1)), 0), MakeGoogleApiTimestamp(