Avoid including time_util in time.h #1485
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Unfortunately, due to protocolbuffers/protobuf#21301, including time_util inside of a header will cause a lot of headaches on MSVC/Windows. While that can and should be resolved separately of this, in the interim there will be a lot of people using protobuf versions without a fix for this for the foreseeable future. This leaves us with only a couple of obvious options: either inline the constants, or move the function definitions into time.cc. I chose the latter since it doesn't seem like there is likely to be a substantial performance hit for this, as these are only used in a couple of locations that don't appear to be very hot paths.
Related issue: #768