summaryrefslogtreecommitdiff
path: root/tools.cpp
diff options
context:
space:
mode:
authorRolf Ahrenberg <Rolf.Ahrenberg@sci.fi>2011-02-11 22:31:46 +0200
committerDieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de>2011-02-11 22:44:52 +0100
commit9ffb94a275c285bb70d9e21037c882956bb6001e (patch)
tree92d8a0d02def8c7ec4bd93b3512317c996a13d8e /tools.cpp
parent2e2f11b1a0435ca6c43614d63a0a63c823981589 (diff)
downloadvdr-plugin-live-9ffb94a275c285bb70d9e21037c882956bb6001e.tar.gz
vdr-plugin-live-9ffb94a275c285bb70d9e21037c882956bb6001e.tar.bz2
Unified date formatting and added recording duration format into translations.
Diffstat (limited to 'tools.cpp')
-rw-r--r--tools.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/tools.cpp b/tools.cpp
index a1ed4ee..35c14e8 100644
--- a/tools.cpp
+++ b/tools.cpp
@@ -51,6 +51,17 @@ istream& operator>>( istream& is, tChannelID& ret )
namespace vdrlive {
+ string FormatDuration( char const* format, int duration )
+ {
+ char result[ 32 ];
+ if ( snprintf(result, sizeof(result), format, duration) < 0 ) {
+ ostringstream builder;
+ builder << "cannot represent duration " << duration << " as requested";
+ throw runtime_error( builder.str() );
+ }
+ return result;
+ }
+
string FormatDateTime( char const* format, time_t time )
{
struct tm tm_r;