Skip to content

Commit d422c36

Browse files
committed
implemented strftime-formatted record_suffix
1 parent f79aa20 commit d422c36

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

ngx_rtmp_record_module.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ ngx_rtmp_record_make_path(ngx_rtmp_session_t *s,
371371
ngx_rtmp_record_ctx_t *ctx;
372372
ngx_rtmp_record_app_conf_t *rracf;
373373
u_char *p, *l;
374+
ngx_tm_t tm;
374375

375376
static u_char buf[NGX_TIME_T_LEN + 1];
376377
static u_char pbuf[NGX_MAX_PATH + 1];
@@ -395,10 +396,15 @@ ngx_rtmp_record_make_path(ngx_rtmp_session_t *s,
395396
rctx->timestamp) - buf, l - p));
396397
}
397398

398-
p = ngx_cpymem(p, rracf->suffix.data,
399-
ngx_min(rracf->suffix.len, (size_t)(l - p)));
400-
*p = 0;
399+
if (ngx_strchr(rracf->suffix.data, '%')) {
400+
ngx_libc_localtime(ngx_cached_time->sec, &tm);
401+
p += strftime((char *) p, l - p, (char *) rracf->suffix.data, &tm);
402+
} else {
403+
p = ngx_cpymem(p, rracf->suffix.data,
404+
ngx_min(rracf->suffix.len, (size_t)(l - p)));
405+
}
401406

407+
*p = 0;
402408
path->data = pbuf;
403409
path->len = p - pbuf;
404410

0 commit comments

Comments
 (0)