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 Friendly Automation
parent bf825a5050
commit ed8ca6c38a
13 changed files with 94 additions and 26 deletions

View File

@@ -4879,7 +4879,11 @@ static int persistence_expires_str2struct(const struct aco_option *opt, struct a
static int persistence_expires_struct2str(const void *obj, const intptr_t *args, char **buf)
{
const struct subscription_persistence *persistence = obj;
return (ast_asprintf(buf, "%ld", persistence->expires.tv_sec) < 0) ? -1 : 0;
char secs[AST_TIME_T_LEN];
ast_time_t_to_string(persistence->expires.tv_sec, secs, sizeof(secs));
return (ast_asprintf(buf, "%s", secs) < 0) ? -1 : 0;
}
#define RESOURCE_LIST_INIT_SIZE 4