grdc.c (227101) | grdc.c (283929) |
---|---|
1/* 2 * Grand digital clock for curses compatible terminals 3 * Usage: grdc [-st] [n] -- run for n seconds (default infinity) 4 * Flags: -s: scroll 5 * -t: output time in 12-hour format 6 * 7 * 8 * modified 10-18-89 for curses (jrl) 9 * 10-18-89 added signal handling 10 * 11 * modified 03-25-03 for 12 hour option 12 * - Samy Al Bahra <samy@kerneled.com> 13 * | 1/* 2 * Grand digital clock for curses compatible terminals 3 * Usage: grdc [-st] [n] -- run for n seconds (default infinity) 4 * Flags: -s: scroll 5 * -t: output time in 12-hour format 6 * 7 * 8 * modified 10-18-89 for curses (jrl) 9 * 10-18-89 added signal handling 10 * 11 * modified 03-25-03 for 12 hour option 12 * - Samy Al Bahra <samy@kerneled.com> 13 * |
14 * $FreeBSD: head/games/grdc/grdc.c 227101 2011-11-05 07:18:53Z ed $ | 14 * $FreeBSD: head/games/grdc/grdc.c 283929 2015-06-02 20:53:17Z emaste $ |
15 */ 16 17#include <err.h> 18#include <ncurses.h> 19#include <signal.h> 20#include <stdlib.h> 21#include <time.h> 22#include <unistd.h> --- 122 unchanged lines hidden (view full) --- 145 mask = 0; 146 tm = localtime(&now.tv_sec); 147 set(tm->tm_sec%10, 0); 148 set(tm->tm_sec/10, 4); 149 set(tm->tm_min%10, 10); 150 set(tm->tm_min/10, 14); 151 152 if (t12) { | 15 */ 16 17#include <err.h> 18#include <ncurses.h> 19#include <signal.h> 20#include <stdlib.h> 21#include <time.h> 22#include <unistd.h> --- 122 unchanged lines hidden (view full) --- 145 mask = 0; 146 tm = localtime(&now.tv_sec); 147 set(tm->tm_sec%10, 0); 148 set(tm->tm_sec/10, 4); 149 set(tm->tm_min%10, 10); 150 set(tm->tm_min/10, 14); 151 152 if (t12) { |
153 if (tm->tm_hour > 12) { 154 tm->tm_hour -= 12; 155 mvaddstr(YBASE + 5, XBASE + 52, "PM"); 156 } else { | 153 if (tm->tm_hour < 12) { |
157 if (tm->tm_hour == 0) 158 tm->tm_hour = 12; | 154 if (tm->tm_hour == 0) 155 tm->tm_hour = 12; |
159 | |
160 mvaddstr(YBASE + 5, XBASE + 52, "AM"); | 156 mvaddstr(YBASE + 5, XBASE + 52, "AM"); |
157 } else { 158 if (tm->tm_hour > 12) 159 tm->tm_hour -= 12; 160 mvaddstr(YBASE + 5, XBASE + 52, "PM"); |
|
161 } 162 } 163 164 set(tm->tm_hour%10, 20); 165 set(tm->tm_hour/10, 24); 166 set(10, 7); 167 set(10, 17); 168 for(k=0; k<6; k++) { --- 105 unchanged lines hidden --- | 161 } 162 } 163 164 set(tm->tm_hour%10, 20); 165 set(tm->tm_hour/10, 24); 166 set(10, 7); 167 set(10, 17); 168 for(k=0; k<6; k++) { --- 105 unchanged lines hidden --- |