-
Notifications
You must be signed in to change notification settings - Fork 27
RSDK-6574: Fix use of time_point
#335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,30 +18,28 @@ const std::string kService = "service"; | |
| const std::string kRDK = "rdk"; | ||
| const std::string kBuiltin = "builtin"; | ||
|
|
||
| using time_pt = std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds>; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What motivated the switch from calling it
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I find people do 'using namespace std::chrono' pretty often so I think this would be a name clash with our |
||
|
|
||
| struct response_metadata { | ||
| std::chrono::time_point<long long, std::chrono::nanoseconds> captured_at; | ||
| time_pt captured_at; | ||
|
|
||
| static response_metadata from_proto(const viam::common::v1::ResponseMetadata& proto); | ||
| static viam::common::v1::ResponseMetadata to_proto(const response_metadata& metadata); | ||
| }; | ||
|
|
||
| bool operator==(const response_metadata& lhs, const response_metadata& rhs); | ||
|
|
||
| /// @brief convert a google::protobuf::Timestamp to | ||
| /// std::chrono::time_point<long long, std::chrono::nanoseconds> | ||
| std::chrono::time_point<long long, std::chrono::nanoseconds> timestamp_to_time_pt( | ||
| const google::protobuf::Timestamp& timestamp); | ||
| /// @brief convert a google::protobuf::Timestamp to time_point | ||
|
||
| time_pt timestamp_to_time_pt(const google::protobuf::Timestamp& timestamp); | ||
|
|
||
| /// @brief convert a std::chrono::time_point<long long, std::chrono::nanoseconds> to | ||
| /// a google::protobuf::Timestamp. | ||
| google::protobuf::Timestamp time_pt_to_timestamp( | ||
| const std::chrono::time_point<long long, std::chrono::nanoseconds>& time_pt); | ||
| /// @brief convert a time_point to a google::protobuf::Timestamp. | ||
|
||
| google::protobuf::Timestamp time_pt_to_timestamp(time_pt); | ||
|
|
||
| std::vector<unsigned char> string_to_bytes(std::string const& s); | ||
| std::string bytes_to_string(std::vector<unsigned char> const& b); | ||
|
|
||
| std::chrono::microseconds from_proto(const google::protobuf::Duration& proto); | ||
| google::protobuf::Duration to_proto(const std::chrono::microseconds& duration); | ||
| google::protobuf::Duration to_proto(std::chrono::microseconds duration); | ||
stuqdog marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| // the authority on a grpc::ClientContext is sometimes set to an invalid uri on mac, causing | ||
| // `rust-utils` to fail to process gRPC requests. This class provides a convenience wrapper around a | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this later be unified with #332 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes I look forward to doing so haha