refactor: Fix get_unix_timestamp return type to use standard time_t#2450
Closed
Lang-Qiu wants to merge 1 commit into
Closed
refactor: Fix get_unix_timestamp return type to use standard time_t#2450Lang-Qiu wants to merge 1 commit into
Lang-Qiu wants to merge 1 commit into
Conversation
|
We are closing this PR as the proposed changes do not align with our current development priorities, address any tracked issues, or meet our required technical standards. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
问题背景
The function
get_unix_timestamp()previously declared its return type aslong int, but it returns the result of the standardtime(NULL)function, which returnstime_t. While these types might be the same on many common platforms (like Linux),time_tis the portable and correct type as specified by the C standard. Usinglong intcould lead to compilation warnings or errors on platforms wheretime_tis defined differently.修改内容
get_unix_timestamp()function fromlong inttotime_t.time(), ensuring code correctness and portability across different platforms and compilers.验证方式
其他信息
time_tis typically defined as alongorlong inton most UNIX-like systems. Code calling this function and assigning the result to along intvariable will still work, possibly with an implicit conversion or a minor warning on some compilers. It is a breaking change in the strictest sense, but it is a necessary correction for portability.