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

Philip Prindeville asteriskteam at digium.com
Sat Feb 26 15:39:43 CST 2022


Attention is currently required from: Joshua Colp, George Joseph, Kevin Harwell, Sebastian Kemper.
Philip Prindeville 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: 
See https://www.gnu.org/software/libc/manual/html_node/Time-Types.html:

> On POSIX-conformant systems, time_t is an integer type and its values represent the number of seconds elapsed since the epoch, which is 00:00:00 on January 1, 1970, Coordinated Universal Time.
> 
> The GNU C Library additionally guarantees that time_t is a signed type, and that all of its functions operate correctly on negative time_t values, which are interpreted as times before the epoch.

I don't think there's any point to requiring support for non-POSIX environments since there's already a quite explicit dependency on POSIX pthreads.

If you want to cite specifications and API's, then the correct thing to do is to take the time_t, convert it to a "struct tm" with localtime(), format it into a string with strftime() with "%s", and then interpolate that string into the buffer.

Likewise, instead of sscanf(), use strptime() with "%s" to get a "struct tm", and then mtkime() to convert that into a time_t.



-- 
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: Sebastian Kemper <sebastian_ml at gmx.net>
Gerrit-Comment-Date: Sat, 26 Feb 2022 21:39:43 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Kevin Harwell <kharwell at digium.com>
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/20220226/e57ffcaf/attachment.html>


More information about the asterisk-code-review mailing list