Revision 1913 trunk/base/utils.c

utils.c (revision 1913)
379 379
    }
380 380
}
381 381

                
382
void
383
nntpgrab_utils_get_readable_time_stamp(time_t stamp, char *stamp_str, int stamp_str_len)
384
{
385
    struct tm *now;
386
    static int nugrft_once = 0;
387

                
388
    if (stamp <= 0) {
389
        stamp_str[0] = '\0';
390
        return;
391
    }
392

                
393
    if ((now = localtime(&stamp)) == NULL) {
394
        // Date could not be parsed
395
        stamp_str[0] = '\0';
396
        return;
397
    }
398

                
399
    if (strftime(stamp_str, stamp_str_len, "%c", now) == 0) {
400
        if (!nugrft_once) {
401
            g_error(__FILE__ ":%i buffer too small", __LINE__);
402
            nugrft_once = 1;
403
        }
404
    }
405
}
406

                
382 407
static gint
383 408
sort_folders_func(gconstpointer a, gconstpointer b)
384 409
{

Also available in: Unified diff