Skip to content
Snippets Groups Projects
Commit a414b9b9 authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#3218] Use static gchar array for timestr to store elapsed time

parent 0f629424
Branches
Tags
No related merge requests found
...@@ -135,8 +135,6 @@ void *threaded_clock_incrementer(void *pc) { ...@@ -135,8 +135,6 @@ void *threaded_clock_incrementer(void *pc) {
while(call->clockStarted) { while(call->clockStarted) {
DEBUG("CLOCK STARTED: %d", call->clockStarted);
gchar *res; gchar *res;
int duration; int duration;
time_t start, current; time_t start, current;
...@@ -147,32 +145,29 @@ void *threaded_clock_incrementer(void *pc) { ...@@ -147,32 +145,29 @@ void *threaded_clock_incrementer(void *pc) {
current = call->_time_current; current = call->_time_current;
if (current == start) { if (current == start) {
// DEBUG("<small>Duration:</small> 0:00"); g_snprintf(call->_timestr, 20, "00:00");
call->_timestr = g_strdup_printf("00:00"); // g_markup_printf_escaped("00:00");
} }
duration = (int) difftime(current, start); duration = (int) difftime(current, start);
if( duration / 60 == 0 ) if( duration / 60 == 0 )
{ {
if( duration < 10 ) if( duration < 10 ) {
call->_timestr = g_strdup_printf("00:0%d", duration); // g_markup_printf_escaped("00:0%d", duration); g_snprintf(call->_timestr, 20, "00:0%d", duration);
else }
call->_timestr = g_strdup_printf("00:%d", duration); // g_markup_printf_escaped("00:%d", duration); else {
g_snprintf(call->_timestr, 20, "00:%d", duration);
}
} }
else else
{ {
if( duration%60 < 10 ) if( duration%60 < 10 ) {
call->_timestr = g_strdup_printf("0%d:0%d", duration/60, duration%60); // g_markup_printf_escaped("0%d:0%d" , duration/60 , duration%60); g_snprintf(call->_timestr, 20, "0%d:0%d", duration/60, duration%60);
else }
call->_timestr = g_strdup_printf("%d:%d", duration/60, duration%60); // g_markup_printf_escaped("%d:%d" , duration/60 , duration%60); else {
g_snprintf(call->_timestr, 20, "%d:%d", duration/60, duration%60);
}
} }
// return g_markup_printf_escaped("<small>Duration:</small> %s", res);
// call->_timestr = res;
// DEBUG("PRINT THE CLOCK")
// DEBUG("CLOCK %s", call->_timestr);
calltree_update_clock(); calltree_update_clock();
...@@ -205,7 +200,7 @@ void create_new_call (callable_type_t type, call_state_t state, gchar* callID , ...@@ -205,7 +200,7 @@ void create_new_call (callable_type_t type, call_state_t state, gchar* callID ,
set_timestamp (&(obj->_time_start)); set_timestamp (&(obj->_time_start));
set_timestamp (&(obj->_time_current)); set_timestamp (&(obj->_time_current));
set_timestamp (&(obj->_time_stop)); set_timestamp (&(obj->_time_stop));
obj->_timestr = NULL; g_snprintf(obj->_timestr, 20, "00:00");
if (g_strcasecmp (callID, "") == 0) if (g_strcasecmp (callID, "") == 0)
call_id = generate_call_id (); call_id = generate_call_id ();
......
...@@ -112,7 +112,7 @@ typedef struct { ...@@ -112,7 +112,7 @@ typedef struct {
time_t _time_start; // The timestamp the call was initiating time_t _time_start; // The timestamp the call was initiating
time_t _time_current; // Clock increment to display call's elapsed time time_t _time_current; // Clock increment to display call's elapsed time
time_t _time_stop; // The timestamp the call was over time_t _time_stop; // The timestamp the call was over
gchar *_timestr; // The timestamp as a string format for gchar _timestr[20]; // The timestamp as a string format for
history_state_t _history_state; // The history state if necessary history_state_t _history_state; // The history state if necessary
srtp_state_t _srtp_state; // The state of security on the call srtp_state_t _srtp_state; // The state of security on the call
gchar* _srtp_cipher; // Cipher used for the srtp session gchar* _srtp_cipher; // Cipher used for the srtp session
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment