Module: kamailio Branch: master Commit: 0aedee8cde7b67b531dabc8a7207b0df1cfdf6a9 URL: https://github.com/kamailio/kamailio/commit/0aedee8cde7b67b531dabc8a7207b0df...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2025-02-05T08:21:39+01:00
msilo: use helper function to get time as signed int
---
Modified: src/modules/msilo/msfuncs.c Modified: src/modules/msilo/msilo.c
---
Diff: https://github.com/kamailio/kamailio/commit/0aedee8cde7b67b531dabc8a7207b0df... Patch: https://github.com/kamailio/kamailio/commit/0aedee8cde7b67b531dabc8a7207b0df...
---
diff --git a/src/modules/msilo/msfuncs.c b/src/modules/msilo/msfuncs.c index 581b30390d4..2851708e894 100644 --- a/src/modules/msilo/msfuncs.c +++ b/src/modules/msilo/msfuncs.c @@ -282,6 +282,7 @@ int m_build_body(str *body, time_t date, str msg, time_t sdate) int ms_extract_time(str *time_str, int *time_val) { struct tm stm; + time_t ttime; int i;
if(time_str == NULL || time_str->s == NULL || time_str->len <= 0 @@ -394,7 +395,8 @@ int ms_extract_time(str *time_str, int *time_val) return -1; } } - *time_val = (int)mktime(&stm); + ttime = mktime(&stm); + *time_val = ksr_time_sint(&ttime, NULL);
return 0; } diff --git a/src/modules/msilo/msilo.c b/src/modules/msilo/msilo.c index 0654eecf54f..11713279167 100644 --- a/src/modules/msilo/msilo.c +++ b/src/modules/msilo/msilo.c @@ -743,7 +743,7 @@ static int m_store_addrs(sip_msg_t *msg, str *owner, str *srcaddr, str *dstaddr) }
/* current time */ - val = (int)(unsigned long long)time(NULL); + val = ksr_time_sint(NULL, NULL);
/* add expiration time */ db_keys[nr_keys] = &sc_exp_time; @@ -1286,7 +1286,7 @@ void m_clean_silo(unsigned int ticks, void *param) db_keys[0] = &sc_exp_time; db_vals[0].type = DB1_INT; db_vals[0].nul = 0; - db_vals[0].val.int_val = (int)time(NULL); + db_vals[0].val.int_val = ksr_time_sint(NULL, NULL); if(msilo_dbf.delete(db_con, db_keys, db_ops, db_vals, 1) < 0) LM_DBG("ERROR cleaning expired messages\n"); } @@ -1383,7 +1383,7 @@ void m_send_ontimer(unsigned int ticks, void *param) db_vals[1].type = DB1_INT; db_vals[1].nul = 0; ttime = time(NULL); - db_vals[1].val.int_val = (int)ttime; + db_vals[1].val.int_val = ksr_time_sint(&ttime, NULL);
if(msilo_dbf.use_table(db_con, &ms_db_table) < 0) { LM_ERR("failed to use_table\n");