Repository navigation
make now() an inline function - #158
Merged
Merged
Conversation
DerDakon
requested review from
alanpost,
jlmuir,
josuah,
leahneukirchen,
mbhangui,
schmonz and
xenotrope
June 18, 2020 17:27
leahneukirchen
approved these changes
Jun 18, 2020
mbhangui
approved these changes
Jun 19, 2020
schmonz
approved these changes
Jun 21, 2020
schmonz
left a comment
Member
There was a problem hiding this comment.
Curious: was the motivation originally correctness or performance?
Member
Author
|
I just found it while looking at other things and decided that it's not worth to keep it because it has no advantage. |
This is a thin wrapper about time(), so just let it do that as inline function. It can't be a macro, as it is called as a function but without arguments. Now it also returns time_t, which avoids losing precision on platforms where time_t is larger than long.
DerDakon
force-pushed
the
Dakon-remove-now
branch
from
June 21, 2020 07:57
78b27cc to
f3a33fd
Compare
Member
Author
|
Hm, noone seems to have spotted that it's not actually an inline function, but just a #define. |
|
A 64-bit time data type should be used everywhere. In looking at how prevalent the datetime handling code is in qmail, I found it to be sprawling and outdated. "Convert it to libtai" is much easier said than done, but replacing datetime_sec with a portable 64-bit TAI or TAI-like timestamp data type is a long-term solution that can be deployed in "substitute it where and when we find it" phases and stages. |
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.
This is a thin wrapper about time(), so just let it do that as inline function. It can't be a macro, as it is called as a function but without arguments. Now it also returns time_t, which avoids losing precision on platforms where time_t is larger than long.