Merge ec0c59a798ff1124295e7d5d82c2e30f1226cc07 into 5e82e4f305dbf3760b6f6e3ba8fb70c3de30a6b9

This commit is contained in:
Érico Nogueira Rolim 2025-01-31 16:48:23 +00:00 committed by GitHub
commit b65b0ca648
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 18 additions and 31 deletions

View File

@ -245,10 +245,6 @@ typedef intptr_t switch_ssize_t;
#define SWITCH_INT64_T_FMT "lld"
#define SWITCH_UINT64_T_FMT "llu"
#ifndef TIME_T_FMT
#define TIME_T_FMT SWITCH_INT64_T_FMT
#endif
#else
#ifndef SWITCH_SSIZE_T_FMT
#define SWITCH_SSIZE_T_FMT (sizeof (switch_ssize_t) == sizeof (long) ? "ld" : sizeof (switch_ssize_t) == sizeof (int) ? "d" : "lld")
@ -266,25 +262,15 @@ typedef intptr_t switch_ssize_t;
#define SWITCH_UINT64_T_FMT (sizeof (long) == 8 ? "lu" : "llu")
#endif
#ifndef TIME_T_FMT
#if defined(__FreeBSD__) && SIZEOF_VOIDP == 4
#define TIME_T_FMT "d"
#else
#if __USE_TIME_BITS64
#define TIME_T_FMT SWITCH_INT64_T_FMT
#else
#define TIME_T_FMT "ld"
#endif
#endif
#endif
#if UINTPTR_MAX == 0xffffffffffffffff
#define FS_64BIT 1
#endif
#endif
#define TIME_T_FMT "lld"
#define TIME_T_CAST(x) ((long long)(x))
#if defined(__sun__) && (defined(__x86_64) || defined(__arch64__))
#define SWITCH_TIME_T_FMT SWITCH_SIZE_T_FMT
#else

View File

@ -2742,7 +2742,7 @@ static switch_status_t write_meta_file(http_file_context_t *context, const char
switch_snprintf(write_data, sizeof(write_data),
"%" TIME_T_FMT ":%s",
switch_epoch_time_now(NULL) + ttl,
TIME_T_CAST(switch_epoch_time_now(NULL) + ttl),
data);

View File

@ -4197,7 +4197,8 @@ void sofia_presence_handle_sip_i_subscribe(int status,
sql = switch_mprintf("insert into sip_dialogs (sip_from_user,sip_from_host,call_info,call_info_state,hostname,expires,rcd,profile_name) "
"values ('%q','%q','%q','seized','%q',%"TIME_T_FMT",%ld,'%q')",
to_user, to_host, switch_str_nil(p), mod_sofia_globals.hostname,
switch_epoch_time_now(NULL) + exp_delta, (long)now, profile->name);
TIME_T_CAST(switch_epoch_time_now(NULL) + exp_delta), (long)now,
profile->name);
if (mod_sofia_globals.debug_sla > 1) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SEIZE SQL %s\n", sql);

View File

@ -4663,39 +4663,39 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t *
tt_created = (time_t) (caller_profile->times->created / 1000000);
mtt_created = (time_t) (caller_profile->times->created / 1000);
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_created);
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, TIME_T_CAST(tt_created));
switch_channel_set_variable(channel, "start_epoch", tmp);
switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->created);
switch_channel_set_variable(channel, "start_uepoch", tmp);
tt_prof_created = (time_t) (caller_profile->times->profile_created / 1000000);
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_prof_created);
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, TIME_T_CAST(tt_prof_created));
switch_channel_set_variable(channel, "profile_start_epoch", tmp);
switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->profile_created);
switch_channel_set_variable(channel, "profile_start_uepoch", tmp);
tt_answered = (time_t) (caller_profile->times->answered / 1000000);
mtt_answered = (time_t) (caller_profile->times->answered / 1000);
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_answered);
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, TIME_T_CAST(tt_answered));
switch_channel_set_variable(channel, "answer_epoch", tmp);
switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->answered);
switch_channel_set_variable(channel, "answer_uepoch", tmp);
tt_bridged = (time_t) (caller_profile->times->bridged / 1000000);
mtt_bridged = (time_t) (caller_profile->times->bridged / 1000);
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_bridged);
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, TIME_T_CAST(tt_bridged));
switch_channel_set_variable(channel, "bridge_epoch", tmp);
switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->bridged);
switch_channel_set_variable(channel, "bridge_uepoch", tmp);
tt_last_hold = (time_t) (caller_profile->times->last_hold / 1000000);
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_last_hold);
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, TIME_T_CAST(tt_last_hold));
switch_channel_set_variable(channel, "last_hold_epoch", tmp);
switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->last_hold);
switch_channel_set_variable(channel, "last_hold_uepoch", tmp);
tt_hold_accum = (time_t) (caller_profile->times->hold_accum / 1000000);
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_hold_accum);
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, TIME_T_CAST(tt_hold_accum));
switch_channel_set_variable(channel, "hold_accum_seconds", tmp);
switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->hold_accum);
switch_channel_set_variable(channel, "hold_accum_usec", tmp);
@ -4703,28 +4703,28 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t *
switch_channel_set_variable(channel, "hold_accum_ms", tmp);
tt_resurrected = (time_t) (caller_profile->times->resurrected / 1000000);
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_resurrected);
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, TIME_T_CAST(tt_resurrected));
switch_channel_set_variable(channel, "resurrect_epoch", tmp);
switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->resurrected);
switch_channel_set_variable(channel, "resurrect_uepoch", tmp);
tt_progress = (time_t) (caller_profile->times->progress / 1000000);
mtt_progress = (time_t) (caller_profile->times->progress / 1000);
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_progress);
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, TIME_T_CAST(tt_progress));
switch_channel_set_variable(channel, "progress_epoch", tmp);
switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->progress);
switch_channel_set_variable(channel, "progress_uepoch", tmp);
tt_progress_media = (time_t) (caller_profile->times->progress_media / 1000000);
mtt_progress_media = (time_t) (caller_profile->times->progress_media / 1000);
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_progress_media);
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, TIME_T_CAST(tt_progress_media));
switch_channel_set_variable(channel, "progress_media_epoch", tmp);
switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->progress_media);
switch_channel_set_variable(channel, "progress_media_uepoch", tmp);
tt_hungup = (time_t) (caller_profile->times->hungup / 1000000);
mtt_hungup = (time_t) (caller_profile->times->hungup / 1000);
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_hungup);
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, TIME_T_CAST(tt_hungup));
switch_channel_set_variable(channel, "end_epoch", tmp);
switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->hungup);
switch_channel_set_variable(channel, "end_uepoch", tmp);

View File

@ -3553,7 +3553,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_expire_registration(int force)
if (force) {
sql = switch_mprintf("delete from registrations where hostname='%q'", switch_core_get_switchname());
} else {
sql = switch_mprintf("delete from registrations where expires > 0 and expires <= %ld and hostname='%q'", now, switch_core_get_switchname());
sql = switch_mprintf("delete from registrations where expires > 0 and expires <= %" TIME_T_FMT " and hostname='%q'", TIME_T_CAST(now), switch_core_get_switchname());
}
switch_sql_queue_manager_push(sql_manager.qm, sql, 0, SWITCH_FALSE);

View File

@ -804,7 +804,7 @@ static uint8_t check_channel_status(originate_global_t *oglobals, uint32_t len,
time_t elapsed = switch_epoch_time_now(NULL) - start;
oglobals->originate_status[i].per_channel_progress_timelimit_sec = elapsed + extend_timeout;
oglobals->originate_status[i].per_channel_timelimit_sec = elapsed + extend_timeout;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "elapsed %" TIME_T_FMT ", timelimit extended to %u\n", elapsed, oglobals->originate_status[i].per_channel_timelimit_sec);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "elapsed %" TIME_T_FMT ", timelimit extended to %u\n", TIME_T_CAST(elapsed), oglobals->originate_status[i].per_channel_timelimit_sec);
} else if (oglobals->cancel_timeout || cancel_timeout) {
/* cancel timeout for this leg only */
oglobals->originate_status[i].per_channel_progress_timelimit_sec = 0;