[Asterisk-code-review] time: add support for time64 libcs (asterisk[master])
Sebastian Kemper
asteriskteam at digium.com
Sat Feb 12 05:59:58 CST 2022
Attention is currently required from: Joshua Colp, George Joseph, Philip Prindeville.
Sebastian Kemper has posted comments on this change. ( https://gerrit.asterisk.org/c/asterisk/+/16621 )
Change subject: time: add support for time64 libcs
......................................................................
Patch Set 4:
(6 comments)
Patchset:
PS3:
> This is not ready yet. The scan parts are not properly done. I'll rework that. […]
Done
PS3:
> Actually the scan parts seem fine. I'll upload a new patch set next. […]
Done
PS3:
> Hi all, […]
Done
Patchset:
PS4:
> So patch set 4 is now up. I run-tested this as well on time64 libc on a 32 bit target. […]
Done
File include/asterisk/time.h:
https://gerrit.asterisk.org/c/asterisk/+/16621/comment/d9d2fbc6_672d6be2
PS4, Line 33: #define TIME_T_CAST(x) ((long long)(x))
> I don't like this unnecessary promotion, and indeed on low-end 32-bit embedded CPU's, 64-bit divisio […]
In my opinion this is fine. In the worst case this is an integer conversion from 32 bits to 64 bits. There is no division, we just cast the time_t to 64 bit for format lld.
And the compiler decides whether this actually gets done at run-time or just turns into a no-op. If the target is using 64 bit time_t it'll be a no-op. And by 2038 time_t will be 64 bit, so again, a no-op.
File res/res_calendar_caldav.c:
https://gerrit.asterisk.org/c/asterisk/+/16621/comment/920c3eff_fe31e1c5
PS4, Line 408: snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, TIME_T_CAST(event->start));
> Since TIME_T_FMT can be something conditionally defined, we shouldn't need to cast unconditionally.
Going your route would add complexity in my opinion.
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/16621
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: Ic8d61b26033f5c486b917e738c9608b0923a844e
Gerrit-Change-Number: 16621
Gerrit-PatchSet: 4
Gerrit-Owner: Sebastian Kemper <sebastian_ml at gmx.net>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Philip Prindeville <philipp at redfish-solutions.com>
Gerrit-Reviewer: Sean Bright <sean at seanbright.com>
Gerrit-CC: George Joseph <gjoseph at digium.com>
Gerrit-Attention: Joshua Colp <jcolp at sangoma.com>
Gerrit-Attention: George Joseph <gjoseph at digium.com>
Gerrit-Attention: Philip Prindeville <philipp at redfish-solutions.com>
Gerrit-Comment-Date: Sat, 12 Feb 2022 11:59:58 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Sebastian Kemper <sebastian_ml at gmx.net>
Comment-In-Reply-To: Philip Prindeville <philipp at redfish-solutions.com>
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220212/da62ce79/attachment-0001.html>
More information about the asterisk-code-review
mailing list