mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-16 01:36:48 +00:00
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:
committed by
Kevin Harwell
parent
d1900d4a4c
commit
287a1a9126
@@ -116,7 +116,7 @@ static size_t curl_body_callback(void *ptr, size_t size, size_t nitems, void *da
|
||||
static void bucket_file_set_expiration(struct ast_bucket_file *bucket_file)
|
||||
{
|
||||
struct ast_bucket_metadata *metadata;
|
||||
char time_buf[32];
|
||||
char time_buf[32], secs[AST_TIME_T_LEN];
|
||||
struct timeval actual_expires = ast_tvnow();
|
||||
|
||||
metadata = ast_bucket_file_metadata_get(bucket_file, "cache-control");
|
||||
@@ -150,7 +150,8 @@ static void bucket_file_set_expiration(struct ast_bucket_file *bucket_file)
|
||||
}
|
||||
|
||||
/* Use 'now' if we didn't get an expiration time */
|
||||
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_bucket_file_metadata_set(bucket_file, "__actual_expires", time_buf);
|
||||
}
|
||||
@@ -304,7 +305,7 @@ static int bucket_file_expired(struct ast_bucket_file *bucket_file)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (sscanf(metadata->value, "%lu", &expires.tv_sec) != 1) {
|
||||
if ((expires.tv_sec = ast_string_to_time_t(metadata->value)) == -1) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user