summaryrefslogtreecommitdiff
path: root/recording.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2012-01-14 13:00:47 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2012-01-14 13:00:47 +0100
commit262f20eaa03e03b7db88a1def47ae95bc7703682 (patch)
tree1b6b00a2edf35778746249b945fe4a3f42435679 /recording.c
parenta7d8c92ddcd5d964930e2f0004b30702111884b4 (diff)
downloadvdr-262f20eaa03e03b7db88a1def47ae95bc7703682.tar.gz
vdr-262f20eaa03e03b7db88a1def47ae95bc7703682.tar.bz2
Changed IndexToHMSF() so that it can handle negative Index values
Diffstat (limited to 'recording.c')
-rw-r--r--recording.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/recording.c b/recording.c
index 698b2db0..cb4918e3 100644
--- a/recording.c
+++ b/recording.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: recording.c 2.41 2011/12/10 14:22:37 kls Exp $
+ * $Id: recording.c 2.42 2012/01/14 12:50:58 kls Exp $
*/
#include "recording.h"
@@ -2035,15 +2035,18 @@ cUnbufferedFile *cFileName::NextFile(void)
cString IndexToHMSF(int Index, bool WithFrame, double FramesPerSecond)
{
- char buffer[16];
+ const char *Sign = "";
+ if (Index < 0) {
+ Index = -Index;
+ Sign = "-";
+ }
double Seconds;
int f = int(modf((Index + 0.5) / FramesPerSecond, &Seconds) * FramesPerSecond + 1);
int s = int(Seconds);
int m = s / 60 % 60;
int h = s / 3600;
s %= 60;
- snprintf(buffer, sizeof(buffer), WithFrame ? "%d:%02d:%02d.%02d" : "%d:%02d:%02d", h, m, s, f);
- return buffer;
+ return cString::sprintf(WithFrame ? "%s%d:%02d:%02d.%02d" : "%s%d:%02d:%02d", Sign, h, m, s, f);
}
int HMSFToIndex(const char *HMSF, double FramesPerSecond)