changed timestamp clock from REALTIME to PRECISE

to increase robustness
pull/8101/head
Makarand Dharmapurikar 8 years ago
parent 1bb6e68fde
commit af564a1e92
  1. 2
      test/cpp/interop/interop_client.cc
  2. 2
      test/cpp/interop/interop_server.cc

@ -849,7 +849,7 @@ bool InteropClient::DoCacheableUnary() {
gpr_log(GPR_DEBUG, "Sending RPC with cacheable response");
// Create request with current timestamp
gpr_timespec ts = gpr_now(GPR_CLOCK_REALTIME);
gpr_timespec ts = gpr_now(GPR_CLOCK_PRECISE);
std::string timestamp = std::to_string(ts.tv_nsec);
SimpleRequest request;
request.mutable_payload()->set_body(timestamp.c_str(), timestamp.size());

@ -156,7 +156,7 @@ class TestServiceImpl : public TestService::Service {
// Response contains current timestamp. We ignore everything in the request.
Status CacheableUnaryCall(ServerContext* context, const SimpleRequest* request,
SimpleResponse* response) {
gpr_timespec ts = gpr_now(GPR_CLOCK_REALTIME);
gpr_timespec ts = gpr_now(GPR_CLOCK_PRECISE);
std::string timestamp = std::to_string(ts.tv_nsec);
response->mutable_payload()->set_body(timestamp.c_str(), timestamp.size());
context->AddInitialMetadata("cache-control", "max-age=60, public");

Loading…
Cancel
Save