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

@@ -351,7 +351,7 @@ int ast_stir_shaken_add_verification(struct ast_channel *chan, const char *ident
*/
static void set_public_key_expiration(const char *public_cert_url, const struct curl_cb_data *data)
{
char time_buf[32];
char time_buf[32], secs[AST_TIME_T_LEN];
char *value;
struct timeval actual_expires = ast_tvnow();
char hash[41];
@@ -389,7 +389,9 @@ static void set_public_key_expiration(const char *public_cert_url, const struct
actual_expires.tv_sec += EXPIRATION_BUFFER;
}
snprintf(time_buf, sizeof(time_buf), "%30lu", actual_expires.tv_sec);
ast_time_t_to_string(actual_expires.tv_sec, secs, sizeof(secs));
snprintf(time_buf, sizeof(time_buf), "%30s", secs);
ast_db_put(hash, "expiration", time_buf);
}