summaryrefslogtreecommitdiff
path: root/tools.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2002-02-17 13:05:05 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2002-02-17 13:05:05 +0100
commita87e7625ddf38cd2e653a256899e9119505e92ac (patch)
tree34f4c7fc34fc42cc6f95c1d18b282b01937a19ae /tools.c
parent3ecbdd489e19a1844843fc1e5e60a689908ffc02 (diff)
downloadvdr-a87e7625ddf38cd2e653a256899e9119505e92ac.tar.gz
vdr-a87e7625ddf38cd2e653a256899e9119505e92ac.tar.bz2
Implemented the 'First day' parameter for repeating timers
Diffstat (limited to 'tools.c')
-rw-r--r--tools.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/tools.c b/tools.c
index 1e60011f..3764a644 100644
--- a/tools.c
+++ b/tools.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: tools.c 1.58 2002/02/16 12:41:44 kls Exp $
+ * $Id: tools.c 1.59 2002/02/17 12:57:23 kls Exp $
*/
#include "tools.h"
@@ -462,6 +462,20 @@ bool SpinUpDisk(const char *FileName)
return false;
}
+const char *WeekDayName(int WeekDay)
+{
+ static char buffer[4];
+ WeekDay = WeekDay == 0 ? 6 : WeekDay - 1; // we start with monday==0!
+ if (0 <= WeekDay && WeekDay <= 6) {
+ const char *day = tr("MonTueWedThuFriSatSun");
+ day += WeekDay * 3;
+ strncpy(buffer, day, 3);
+ return buffer;
+ }
+ else
+ return "???";
+}
+
const char *DayDateTime(time_t t)
{
static char buffer[32];
@@ -469,11 +483,7 @@ const char *DayDateTime(time_t t)
time(&t);
struct tm tm_r;
tm *tm = localtime_r(&t, &tm_r);
- int weekday = tm->tm_wday == 0 ? 6 : tm->tm_wday - 1; // we start with monday==0!
- const char *day = tr("MonTueWedThuFriSatSun");
- day += weekday * 3;
- strncpy(buffer, day, 3);
- snprintf(buffer + 3, sizeof(buffer) - 3, " %2d.%02d %02d:%02d", tm->tm_mday, tm->tm_mon + 1, tm->tm_hour, tm->tm_min);
+ snprintf(buffer, sizeof(buffer), "%s %2d.%02d %02d:%02d", WeekDayName(tm->tm_wday), tm->tm_mday, tm->tm_mon + 1, tm->tm_hour, tm->tm_min);
return buffer;
}