From 5470136c6b845ff50bd23c54d64301e72e78da30 Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Sat, 22 Feb 2025 15:09:06 +0100 Subject: [PATCH] Adjust the server time format with the client one in ClientGuide Server and client request/responce time format differs, since std::chrono::time_point::time_since_epoch() output contains undeterminated units. Make the explicit conversion to milliseconds, to align the time format between server and client. Pick-to: 6.8 6.9 Change-Id: I5914221d3b3b8043721f4d97705ccb54c679be9c Reviewed-by: Dennis Oberst --- examples/grpc/clientguide/server/main.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/grpc/clientguide/server/main.cpp b/examples/grpc/clientguide/server/main.cpp index bbf746b7..cf95040f 100644 --- a/examples/grpc/clientguide/server/main.cpp +++ b/examples/grpc/clientguide/server/main.cpp @@ -20,7 +20,9 @@ namespace { int64_t now() { - return std::chrono::system_clock::now().time_since_epoch().count(); + return std::chrono::duration_cast(std::chrono::system_clock::now() + .time_since_epoch()) + .count(); } std::ostream &operator<<(std::ostream &stream, const Request &request)