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:
parent
8e2e1e212c
commit
f6a77ec0a6
@ -975,7 +975,7 @@ Screenshot.Source="Screenshot (Source)"
|
||||
FilenameFormatting.completer="%CCYY-%MM-%DD %hh-%mm-%ss\n%YY-%MM-%DD %hh-%mm-%ss\n%Y-%m-%d %H-%M-%S\n%y-%m-%d %H-%M-%S\n%a %Y-%m-%d %H-%M-%S\n%A %Y-%m-%d %H-%M-%S\n%Y-%b-%d %H-%M-%S\n%Y-%B-%d %H-%M-%S\n%Y-%m-%d %I-%M-%S-%p\n%Y-%m-%d %H-%M-%S-%z\n%Y-%m-%d %H-%M-%S-%Z\n%FPS\n%CRES\n%ORES\n%VF"
|
||||
|
||||
# basic mode 'output' settings - advanced section - recording subsection - TT
|
||||
FilenameFormatting.TT="%CCYY Year, four digits\n%YY Year, last two digits (00-99)\n%MM Month as a decimal number (01-12)\n%DD Day of the month, zero-padded (01-31)\n%hh Hour in 24h format (00-23)\n%mm Minute (00-59)\n%ss Second (00-61)\n%% A % sign\n%a Abbreviated weekday name\n%A Full weekday name\n%b Abbreviated month name\n%B Full month name\n%d Day of the month, zero-padded (01-31)\n%H Hour in 24h format (00-23)\n%I Hour in 12h format (01-12)\n%m Month as a decimal number (01-12)\n%M Minute (00-59)\n%p AM or PM designation\n%S Second (00-61)\n%y Year, last two digits (00-99)\n%Y Year\n%z ISO 8601 offset from UTC in timezone\n%Z Timezone name or abbreviation\n%FPS Frames per second\n%CRES Base (canvas) resolution\n%ORES Output (scaled) resolution\n%VF Video format"
|
||||
FilenameFormatting.TT="%CCYY Year, four digits\n%YY Year, last two digits (00-99)\n%MM Month as a decimal number (01-12)\n%DD Day of the month, zero-padded (01-31)\n%hh Hour in 24h format (00-23)\n%mm Minute (00-59)\n%ss Second (00-61)\n%% A % sign\n%a Abbreviated weekday name\n%A Full weekday name\n%b Abbreviated month name\n%B Full month name\n%d Day of the month, zero-padded (01-31)\n%H Hour in 24h format (00-23)\n%I Hour in 12h format (01-12)\n%m Month as a decimal number (01-12)\n%M Minute (00-59)\n%p AM or PM designation\n%s Time in seconds since UNIX epoch\n%S Second (00-61)\n%y Year, last two digits (00-99)\n%Y Year\n%z ISO 8601 offset from UTC in timezone\n%Z Timezone name or abbreviation\n%FPS Frames per second\n%CRES Base (canvas) resolution\n%ORES Output (scaled) resolution\n%VF Video format"
|
||||
|
||||
# basic mode 'video' settings
|
||||
Basic.Settings.Video="Video"
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user