protobuf
protobuf copied to clipboard
TimeUtils::GetCurrentTime() and fractions of second
Version: 3.16 Language: C++ Linux GCC 7.2
I do "message.mutable_timestamp->CopyFrom(util::TimeUtil::GetCurrentTime());"
I expect resulting timestamp field to contain current time up to milliseconds at least because Linux has gettimeofday() supporting milliseconds. I see the time rounded to whole seconds.
In protobuf sources I see
void GetCurrentTime(int64* seconds, int32* nanos) {
// TODO(xiaofeng): Improve the accuracy of this implementation (or just
// remove this method from protobuf).
*seconds = time(nullptr);
*nanos = 0;
}
xiaofeng was right. This method shouldn't be here. However now it is and we're stuck with it. I'm not sure if changing the behavior now is likely to break any clients or not.
Could this be included in the documentation? Might avoid some confusion.
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.
This issue is labeled inactive
because the last activity was over 90 days ago.
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please reopen it.
This issue was closed and archived because there has been no new activity in the 14 days since the inactive
label was added.