diff options
author | Christian Wieninger <cwieninger (at) gmx (dot) de> | 2007-05-25 16:58:56 +0000 |
---|---|---|
committer | Christian Wieninger <cwieninger (at) gmx (dot) de> | 2007-05-25 16:58:56 +0000 |
commit | 3a4d59c9ac7226432120633ad394464d37e5f497 (patch) | |
tree | 926d255db984d789a5e8f1768e4f5985735377b1 /tools.cpp | |
parent | 181c5487cc5abbd21b0a8352a507aae4504c683c (diff) | |
download | vdr-plugin-live-3a4d59c9ac7226432120633ad394464d37e5f497.tar.gz vdr-plugin-live-3a4d59c9ac7226432120633ad394464d37e5f497.tar.bz2 |
- first version of "userdef. times" in "What's on?"
Diffstat (limited to 'tools.cpp')
-rw-r--r-- | tools.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -144,4 +144,19 @@ std::string MD5Hash(std::string const& str) return hashStr.str(); } +#define HOURS(x) ((x)/100) +#define MINUTES(x) ((x)%100) + +time_t GetTimeT(std::string timestring) // timestring in HH:MM +{ + timestring = StringReplace(timestring, ":", ""); + int iTime = lexical_cast< int >( timestring ); + struct tm tm_r; + time_t t = time(NULL); + tm* tmnow = localtime_r(&t, &tm_r); + tmnow->tm_hour = HOURS(iTime); + tmnow->tm_min = MINUTES(iTime); + return mktime(tmnow); +} + } // namespace vdrlive |