summaryrefslogtreecommitdiff
path: root/tools.cpp
diff options
context:
space:
mode:
authorChristian Wieninger <cwieninger (at) gmx (dot) de>2007-05-27 08:02:35 +0000
committerChristian Wieninger <cwieninger (at) gmx (dot) de>2007-05-27 08:02:35 +0000
commitffe665bc701a0e89706394e7180c92e3ea95dd4f (patch)
tree6900f28499eb0acf095533c25b50d18038f8f312 /tools.cpp
parent7be7e55411a9556ed08107ff5605bfb5f75435d5 (diff)
downloadvdr-plugin-live-ffe665bc701a0e89706394e7180c92e3ea95dd4f.tar.gz
vdr-plugin-live-ffe665bc701a0e89706394e7180c92e3ea95dd4f.tar.bz2
- again more flexible handling a lazy input time
- redisplay selected or given time (dropdown / input field) in corresponding field after reload
Diffstat (limited to 'tools.cpp')
-rw-r--r--tools.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/tools.cpp b/tools.cpp
index b47d40a..ff88204 100644
--- a/tools.cpp
+++ b/tools.cpp
@@ -152,8 +152,14 @@ std::string ExpandTimeString(std::string timestring)
string::size_type colonpos = timestring.find(":");
if (colonpos == string::npos)
{
- timestring += string(std::max(0,(int)(4 - timestring.size())), '0');
- timestring = string(timestring.begin(), timestring.begin() + 2) + ":" + string(timestring.begin() + 2, timestring.end());
+ if (timestring.size() == 1)
+ timestring = "0" + timestring + ":00";
+ else if (timestring.size() == 2)
+ timestring = timestring + ":00";
+ else if (timestring.size() == 3)
+ timestring = "0" + string(timestring.begin(), timestring.begin() + 1) + ":" + string(timestring.begin() + 1, timestring.end());
+ else
+ timestring = string(timestring.begin(), timestring.begin() + 2) + ":" + string(timestring.begin() + 2, timestring.end());
}
else
{