Ignore:
Timestamp:
01/12/11 20:20:54 (10 years ago)
Author:
alno
Message:

WebIf: Improve sec2timeformat function

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/oscam-http-helpers.c

    r4427 r4430  
    614614
    615615/* Format a seconds integer to hh:mm:ss or dd hh:mm:ss depending hrs >24 */
    616 char *sec2timeformat(int seconds) {
    617     char *value = (char *) malloc((12 * sizeof(char)));
    618     value[0] = '\0';
     616char *sec2timeformat(struct templatevars *vars, int seconds) {
     617    char *value;
     618    if(!cs_malloc(&value, 12 * sizeof(char), -1))
     619        return "";
     620
    619621    int secs = 0, fullmins = 0, mins = 0, fullhours = 0, hours = 0, days = 0;
    620622
     
    634636    else            sprintf(value, "%02dd %02d:%02d:%02d", days, hours, mins, secs);
    635637
    636     return value;
     638    return tpl_addTmp(vars, value);
    637639}
    638640
Note: See TracChangeset for help on using the changeset viewer.