diff options
author | wm4 <wm4@nowhere> | 2012-09-01 21:59:13 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2012-09-18 21:04:47 +0200 |
commit | 53bfaecd40aa7b34dcc9c90064e36f2ffe227fc0 (patch) | |
tree | 7c8865437d2e48d1c9782c37520d04d3e0604dca /screenshot.c | |
parent | 5a13f5a5e8dd63c899581db86c51c9bb093fcdde (diff) | |
download | mpv-53bfaecd40aa7b34dcc9c90064e36f2ffe227fc0.tar.bz2 mpv-53bfaecd40aa7b34dcc9c90064e36f2ffe227fc0.tar.xz |
core: remove duplicated format_time() functions
This was an on-going transition to make mplayer format all times in the
same format.
Diffstat (limited to 'screenshot.c')
-rw-r--r-- | screenshot.c | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/screenshot.c b/screenshot.c index 032fa132f4..79356ed9a2 100644 --- a/screenshot.c +++ b/screenshot.c @@ -67,20 +67,6 @@ static char *stripext(void *talloc_ctx, const char *s) return talloc_asprintf(talloc_ctx, "%.*s", end - s, s); } -static char *format_time(void *talloc_ctx, double time, bool sub_seconds) -{ - int h, m, s = time; - h = s / 3600; - s -= h * 3600; - m = s / 60; - s -= m * 60; - char *res = talloc_asprintf(talloc_ctx, "%02d:%02d:%02d", h, m, s); - if (sub_seconds) - res = talloc_asprintf_append(res, ".%03d", - (int)((time - (int)time) * 1000)); - return res; -} - static char *do_format_property(struct MPContext *mpctx, struct bstr s) { struct bstr prop_name = s; int fallbackpos = bstrchr(s, ':'); @@ -179,10 +165,12 @@ static char *create_fname(struct MPContext *mpctx, char *template, break; } case 'p': - case 'P': - append_filename(&res, - format_time(res, get_current_time(mpctx), fmt == 'P')); + case 'P': { + char *t = mp_format_time(get_current_time(mpctx), fmt == 'P'); + append_filename(&res, t); + talloc_free(t); break; + } case 't': { char fmt = *template; if (!fmt) |