summaryrefslogtreecommitdiff
path: root/aclock.c
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2009-10-26 02:17:51 +0000
committerDimitri Sokolyuk <demon@dim13.org>2009-10-26 02:17:51 +0000
commit75e087d23ff74441387475d5bb022f293f8e7a21 (patch)
tree5b251a8cb7d5a9dcb6d3c5607d6b6d7b78856f45 /aclock.c
parentfb5789662243a4353ae31ada6a4396071b669d60 (diff)
add textclock
Diffstat (limited to 'aclock.c')
-rw-r--r--aclock.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/aclock.c b/aclock.c
index 1b5733e..9ac7051 100644
--- a/aclock.c
+++ b/aclock.c
@@ -21,6 +21,8 @@ int die = 0;
int redraw = 0;
enum {RED = 1, CYAN, BLUE};
+char *strtime(char *, size_t, struct tm *);
+
void
catch(int sig)
{
@@ -87,7 +89,7 @@ const char INFO[] = "Copyright (c) 2002 by Antek Sawicki <tenox@tenox.tc>\n"
int
main(void)
{
- char digital_time[32];
+ char digital_time[32], stime[80];
int FontHW = 2;
int sXmax, sYmax, smax, hand_max, sXcen, sYcen;
time_t t;
@@ -151,10 +153,14 @@ main(void)
attron(COLOR_PAIR(CYAN));
strftime(digital_time, sizeof(digital_time), "%d-%b-%y", ltime);
- mvprintw(sYmax / 4, sXcen - 5, digital_time);
+ mvprintw(sYmax / 4, sXcen - strlen(digital_time) / 2, digital_time);
strftime(digital_time, sizeof(digital_time), "%H:%M:%S", ltime);
- mvprintw(3 * sYmax / 4, sXcen - 4, digital_time);
+ mvprintw(3 * sYmax / 4, sXcen - strlen(digital_time) / 2, digital_time);
attroff(COLOR_PAIR(CYAN));
+ strtime(stime, sizeof(stime), ltime);
+ attron(COLOR_PAIR(BLUE));
+ mvprintw(sYmax - 1, sXcen - strlen(stime) / 2, stime);
+ attroff(COLOR_PAIR(BLUE));
refresh();
pause();