[Asterisk-code-review] time: add support for time64 libcs (asterisk[master])

Sebastian Kemper asteriskteam at digium.com
Sat Feb 26 04:10:29 CST 2022


Attention is currently required from: Joshua Colp, George Joseph, Kevin Harwell, 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:

(1 comment)

Patchset:

PS4: 
> I'm inclined to agree.  There are two paths forward: […]
Hi all,

I don't think there is a need to remove the use of PRIdN macros. But PRIdN macros do not have a relation to time_t. So using them for time_t is not the right way in my opinion.

a) time_t may be long or long long. But time_t may also be unsigned or float.
   - Does PRIdN approach take care of this? No.
   - Does "cast to (long long) and use %lld" approach take care of this? Yes.

b) Checking for __USE_TIME_BITS64 is also not portable. libcs may or may not declare it. Right now glibc does not declare it, yet its "arc" target, which is a 32 bit target, is already y2038 safe, it's using 64 bit time_t (long long).
   - Does PRIdN approach take care of this? No.
   - Does "cast to (long long) and use %lld" approach take care of this? Yes.

In 2013 OpenBSD discussed the y2038 issue at a convention (slides: [1]). Under "Simple instructions for conversions", "Systematic conversions" and "Userland audit" they suggest (long long) casts and %lld.

These slides were then discussed further (see [2]). When it came to printing time_t, the way I read it, the consensus was again to use casts to (long long) and %lld.

[1] https://www.openbsd.org/papers/eurobsdcon_2013_time_t/
[2] https://news.ycombinator.com/item?id=6466428

Kind regards,
Sebastian



-- 
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-CC: Kevin Harwell <kharwell at digium.com>
Gerrit-Attention: Joshua Colp <jcolp at sangoma.com>
Gerrit-Attention: George Joseph <gjoseph at digium.com>
Gerrit-Attention: Kevin Harwell <kharwell at digium.com>
Gerrit-Attention: Philip Prindeville <philipp at redfish-solutions.com>
Gerrit-Comment-Date: Sat, 26 Feb 2022 10:10:29 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Kevin Harwell <kharwell at digium.com>
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/20220226/21849b5d/attachment-0001.html>


More information about the asterisk-code-review mailing list