Skip to content

Avoid including time_util in time.h #1447

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

Closed

Conversation

jchadwick-buf
Copy link
Contributor

@jchadwick-buf jchadwick-buf commented Apr 18, 2025

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

@jnthntatum
Copy link
Collaborator

would you mind rebasing and opening a new PR? I updated the cloud build config so I can test this, but it needs a new PR to trigger it.

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.
@jchadwick-buf jchadwick-buf force-pushed the internal-time-windows branch from 49ff1aa to 9ec5176 Compare May 6, 2025 19:53
@jchadwick-buf
Copy link
Contributor Author

Done. Reopened as #1485.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants