diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2001-08-25 13:27:26 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2001-08-25 13:27:26 +0200 |
commit | 14d3933d91af23a9d79c083163fe6f0281475001 (patch) | |
tree | cafb1cc5bb640d02f0a615a9d00c3511f5b7db40 /tools.c | |
parent | 8edfaa2345140bb35eeaa29e08940eb665389a65 (diff) | |
download | vdr-14d3933d91af23a9d79c083163fe6f0281475001.tar.gz vdr-14d3933d91af23a9d79c083163fe6f0281475001.tar.bz2 |
The menus and the channel display now show the current date and time
Diffstat (limited to 'tools.c')
-rw-r--r-- | tools.c | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: tools.c 1.40 2001/08/17 12:45:42 kls Exp $ + * $Id: tools.c 1.41 2001/08/25 13:21:22 kls Exp $ */ #define _GNU_SOURCE @@ -18,6 +18,7 @@ #include <stdlib.h> #include <sys/time.h> #include <unistd.h> +#include "i18n.h" #define MaxBuffer 1000 @@ -395,6 +396,20 @@ bool SpinUpDisk(const char *FileName) return false; } +const char *DayDateTime(time_t t) +{ + static char buffer[32]; + if (t == 0) + time(&t); + tm *tm = localtime(&t); + 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); + return buffer; +} + // --- cFile ----------------------------------------------------------------- bool cFile::files[FD_SETSIZE] = { false }; |