mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-24 23:31:36 +08:00
libobs/util: Add %s string replacement for unix time
Adds %s which replaces the keyword with the current unix epoch time. The %s keyword is common in languages like PHP and Python, and even some C implementations, but it is not standard so this is a fallback.
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <inttypes.h>
|
||||
#include <locale.h>
|
||||
#include "c99defs.h"
|
||||
#include "platform.h"
|
||||
@@ -782,6 +783,10 @@ char *os_generate_formatted_filename(const char *extension, bool space,
|
||||
strcpy(convert, get_video_format_name(
|
||||
ovi.output_format));
|
||||
replace_text(&sf, pos, 3, convert);
|
||||
|
||||
} else if (astrcmp_n(cmp, "%s", 2) == 0) {
|
||||
sprintf(convert, "%" PRId64, (int64_t)now);
|
||||
replace_text(&sf, pos, 2, convert);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user