|
|
@ -84,11 +84,13 @@ static void create_parent_dirs(char *dir) {
|
|
|
|
|
|
|
|
|
|
|
|
output_t *output_new(const char *path, const char *call, const char *type) {
|
|
|
|
output_t *output_new(const char *path, const char *call, const char *type) {
|
|
|
|
// construct output file name
|
|
|
|
// construct output file name
|
|
|
|
time_t now = time(NULL);
|
|
|
|
struct timeval now;
|
|
|
|
struct tm tm;
|
|
|
|
struct tm tm;
|
|
|
|
localtime_r(&now, &tm);
|
|
|
|
|
|
|
|
const char *ax = call;
|
|
|
|
const char *ax = call;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gettimeofday(&now, NULL);
|
|
|
|
|
|
|
|
localtime_r(&now.tv_sec, &tm);
|
|
|
|
|
|
|
|
|
|
|
|
GString *f = g_string_new("");
|
|
|
|
GString *f = g_string_new("");
|
|
|
|
for (const char *p = output_pattern; *p; p++) {
|
|
|
|
for (const char *p = output_pattern; *p; p++) {
|
|
|
|
if (*p != '%') {
|
|
|
|
if (*p != '%') {
|
|
|
@ -127,6 +129,9 @@ output_t *output_new(const char *path, const char *call, const char *type) {
|
|
|
|
case 'S':
|
|
|
|
case 'S':
|
|
|
|
g_string_append_printf(f, "%02i", tm.tm_sec);
|
|
|
|
g_string_append_printf(f, "%02i", tm.tm_sec);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'u':
|
|
|
|
|
|
|
|
g_string_append_printf(f, "%06li", (long) now.tv_usec);
|
|
|
|
|
|
|
|
break;
|
|
|
|
case '0':
|
|
|
|
case '0':
|
|
|
|
case '1':
|
|
|
|
case '1':
|
|
|
|
case '2':
|
|
|
|
case '2':
|
|
|
|