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

@@ -489,7 +489,10 @@ static int expiration_str2struct(const struct aco_option *opt, struct ast_variab
static int expiration_struct2str(const void *obj, const intptr_t *args, char **buf)
{
const struct ast_sip_contact *contact = obj;
return (ast_asprintf(buf, "%ld", contact->expiration_time.tv_sec) < 0) ? -1 : 0;
char secs[AST_TIME_T_LEN];
ast_time_t_to_string(contact->expiration_time.tv_sec, secs, sizeof(secs));
return (ast_asprintf(buf, "%s", secs) < 0) ? -1 : 0;
}
static int permanent_uri_sort_fn(const void *obj_left, const void *obj_right, int flags)