From 3ae855afdc7bdead939d3eea1b9ed79e6794a962 Mon Sep 17 00:00:00 2001 From: xu Date: Sun, 14 Jan 2024 11:20:13 +0800 Subject: [PATCH] =?UTF-8?q?fix=20time=5Fexpires=20vc=20long=E6=98=AF32?= =?UTF-8?q?=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/switch_xml.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/switch_xml.c b/src/switch_xml.c index d54294df92..4772e675d9 100644 --- a/src/switch_xml.c +++ b/src/switch_xml.c @@ -2096,8 +2096,8 @@ static switch_status_t switch_xml_locate_user_cache(const char *key, const char switch_time_t time_now = 0; time_now = switch_micro_time_now(); - time_expires = atol(expires_lookup); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Cache Info\nTime Now:\t%ld\nExpires:\t%ld\n", (long)time_now, (long)time_expires); + time_expires = atoll(expires_lookup); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Cache Info\nTime Now:\t%" SWITCH_TIME_T_FMT "\nExpires:\t%" SWITCH_TIME_T_FMT "\n", time_now, time_expires); if (time_expires < time_now) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Cache expired for %s@%s, doing fresh lookup\n", user_name, domain_name); } else { @@ -2133,7 +2133,7 @@ static void switch_xml_user_cache(const char *key, const char *user_name, const } if (expires) { char *expires_val = (char *)switch_core_hash_insert_alloc(CACHE_EXPIRES_HASH, mega_key, 22); - if (!snprintf(expires_val, 22, "%ld", (long)expires)) { + if (!snprintf(expires_val, 22, "%" SWITCH_TIME_T_FMT, expires)) { switch_core_hash_delete(CACHE_EXPIRES_HASH, mega_key); switch_safe_free(expires_val); }