time: add support for time64 libcs

Treat time_t's as entirely unique and use the POSIX API's for
converting to/from strings.

Lastly, a 64-bit integer formats as 20 digits at most in base10.
Don't need to have any 100 byte buffers to hold that.

ASTERISK-29674 #close

Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
Change-Id: Id7b25bdca8f92e34229f6454f6c3e500f2cd6f56
This commit is contained in:
Philip Prindeville
2022-02-13 12:06:37 -07:00
committed by Kevin Harwell
parent d1900d4a4c
commit 287a1a9126
13 changed files with 94 additions and 26 deletions

View File

@@ -2722,6 +2722,7 @@ int ast_sip_format_contact_ami(void *obj, void *arg, int flags)
struct ast_sip_contact_status *status;
struct ast_str *buf;
const struct ast_sip_endpoint *endpoint = ami->arg;
char secs[AST_TIME_T_LEN];
buf = ast_sip_create_ami_event("ContactStatusDetail", ami);
if (!buf) {
@@ -2733,7 +2734,8 @@ int ast_sip_format_contact_ami(void *obj, void *arg, int flags)
ast_str_append(&buf, 0, "AOR: %s\r\n", wrapper->aor_id);
ast_str_append(&buf, 0, "URI: %s\r\n", contact->uri);
ast_str_append(&buf, 0, "UserAgent: %s\r\n", contact->user_agent);
ast_str_append(&buf, 0, "RegExpire: %ld\r\n", contact->expiration_time.tv_sec);
ast_time_t_to_string(contact->expiration_time.tv_sec, secs, sizeof(secs));
ast_str_append(&buf, 0, "RegExpire: %s\r\n", secs);
if (!ast_strlen_zero(contact->via_addr)) {
ast_str_append(&buf, 0, "ViaAddress: %s", contact->via_addr);
if (contact->via_port) {