Added WeekDayNameFull()

This commit is contained in:
Klaus Schmidinger 2007-06-23 13:40:04 +02:00
parent d66eba77c2
commit 7c86dcaa27
3 changed files with 27 additions and 2 deletions

View File

@ -5270,6 +5270,8 @@ Video Disk Recorder Revision History
- Fonts can now be created with a width that overwrites the default width (thanks - Fonts can now be created with a width that overwrites the default width (thanks
to Andreas Mair). to Andreas Mair).
- Added full weekday names to i18n.c for plugins to use (thanks to Patrice Staudt). - Added full weekday names to i18n.c for plugins to use (thanks to Patrice Staudt).
The new function WeekDayNameFull() can be used to get these names from integer
values (just like the abbreviated weekday names).
- Fixed stripping i18n stuff from font names (reported by Anssi Hannula). - Fixed stripping i18n stuff from font names (reported by Anssi Hannula).
- Improved performance of the SVDRP commands LSTC and CHAN when used with a - Improved performance of the SVDRP commands LSTC and CHAN when used with a
channel name. channel name.

23
tools.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: tools.c 1.129 2007/06/17 11:02:34 kls Exp $ * $Id: tools.c 1.130 2007/06/23 13:38:30 kls Exp $
*/ */
#include "tools.h" #include "tools.h"
@ -871,6 +871,27 @@ cString WeekDayName(time_t t)
return WeekDayName(localtime_r(&t, &tm_r)->tm_wday); return WeekDayName(localtime_r(&t, &tm_r)->tm_wday);
} }
cString WeekDayNameFull(int WeekDay)
{
WeekDay = WeekDay == 0 ? 6 : WeekDay - 1; // we start with Monday==0!
switch (WeekDay) {
case 0: return tr("Monday");
case 1: return tr("Tuesday");
case 2: return tr("Wednesday");
case 3: return tr("Thursday");
case 4: return tr("Friday");
case 5: return tr("Saturday");
case 6: return tr("Sunday");
}
return "???";
}
cString WeekDayNameFull(time_t t)
{
struct tm tm_r;
return WeekDayNameFull(localtime_r(&t, &tm_r)->tm_wday);
}
cString DayDateTime(time_t t) cString DayDateTime(time_t t)
{ {
char buffer[32]; char buffer[32];

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: tools.h 1.102 2007/06/17 11:00:20 kls Exp $ * $Id: tools.h 1.103 2007/06/23 13:34:28 kls Exp $
*/ */
#ifndef __TOOLS_H #ifndef __TOOLS_H
@ -196,6 +196,8 @@ void TouchFile(const char *FileName);
time_t LastModifiedTime(const char *FileName); time_t LastModifiedTime(const char *FileName);
cString WeekDayName(int WeekDay); cString WeekDayName(int WeekDay);
cString WeekDayName(time_t t); cString WeekDayName(time_t t);
cString WeekDayNameFull(int WeekDay);
cString WeekDayNameFull(time_t t);
cString DayDateTime(time_t t = 0); cString DayDateTime(time_t t = 0);
cString TimeToString(time_t t); cString TimeToString(time_t t);
cString DateString(time_t t); cString DateString(time_t t);