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
No related branches found
No related tags found
No related merge requests found
......@@ -135,8 +135,6 @@ void *threaded_clock_incrementer(void *pc) {
while(call->clockStarted) {
DEBUG("CLOCK STARTED: %d", call->clockStarted);
gchar *res;
int duration;
time_t start, current;
......@@ -147,32 +145,29 @@ void *threaded_clock_incrementer(void *pc) {
current = call->_time_current;
if (current == start) {
// DEBUG("<small>Duration:</small> 0:00");
call->_timestr = g_strdup_printf("00:00"); // g_markup_printf_escaped("00:00");
g_snprintf(call->_timestr, 20, "00:00");
}
duration = (int) difftime(current, start);
if( duration / 60 == 0 )
{
if( duration < 10 )
call->_timestr = g_strdup_printf("00:0%d", duration); // g_markup_printf_escaped("00:0%d", duration);
else
call->_timestr = g_strdup_printf("00:%d", duration); // g_markup_printf_escaped("00:%d", duration);
if( duration < 10 ) {
g_snprintf(call->_timestr, 20, "00:0%d", duration);
}
else {
g_snprintf(call->_timestr, 20, "00:%d", duration);
}
}
else
{
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);
else
call->_timestr = g_strdup_printf("%d:%d", duration/60, duration%60); // g_markup_printf_escaped("%d:%d" , duration/60 , duration%60);
if( duration%60 < 10 ) {
g_snprintf(call->_timestr, 20, "0%d:0%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();
......@@ -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_current));
set_timestamp (&(obj->_time_stop));
obj->_timestr = NULL;
g_snprintf(obj->_timestr, 20, "00:00");
if (g_strcasecmp (callID, "") == 0)
call_id = generate_call_id ();
......
......@@ -112,7 +112,7 @@ typedef struct {
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_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
srtp_state_t _srtp_state; // The state of security on the call
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.
Finish editing this message first!
Please register or to comment