Skip to content

make now() an inline function - #158

Merged
DerDakon merged 1 commit into
masterfrom
Dakon-remove-now
Jun 21, 2020
Merged

DerDakon merged 1 commit into
masterfrom
Dakon-remove-now

Conversation

@DerDakon

Copy link
Copy Markdown
Member

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.

@schmonz schmonz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious: was the motivation originally correctness or performance?

@DerDakon

Copy link
Copy Markdown
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
DerDakon merged commit f3a33fd into master Jun 21, 2020
@DerDakon
DerDakon deleted the Dakon-remove-now branch June 21, 2020 08:05
@DerDakon

Copy link
Copy Markdown
Member Author

Hm, noone seems to have spotted that it's not actually an inline function, but just a #define.

@xenotrope

Copy link
Copy Markdown

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.

@schmonz schmonz added this to the 1.09 milestone Sep 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants