Code Monkey home page Code Monkey logo

tty-clock's People

Contributors

anarcat avatar arieboven avatar benoitzugmeyer avatar briancain avatar carla-v avatar cgie avatar cheaterman avatar dhruv-vanjari avatar edwardbetts avatar gknauf avatar holizz avatar jcvernaleo avatar jwilk avatar livibetter avatar markand avatar mmuman avatar mooncactus avatar paultag avatar sanchithhegde avatar trofi avatar vakuum avatar vaygr avatar wessels avatar xorg62 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tty-clock's Issues

New option for label

I'd love to be able to specify a custom label via a new argument. This label should be shown above the time, just like the date can be shown below. E.g. -l "New York".

Along with #50, this would allow for awesome World Clock monitors, with multiple clocks showing the time in New York, London, Tokyo, etc. -- or any list of cities relevant for yourself or your business.

will not 'make'. with errors. new ncurses?

[dave@manjaro tty-clock-master :) ]$ make
build ttyclock.c
CC ttyclock.c
/tmp/ccky1p0y.o: In function init': ttyclock.c:(.text+0xac): undefined reference tonewterm'
ttyclock.c:(.text+0xec): undefined reference to set_term' ttyclock.c:(.text+0xf3): undefined reference toinitscr'
ttyclock.c:(.text+0xf8): undefined reference to cbreak' ttyclock.c:(.text+0xfd): undefined reference tonoecho'
ttyclock.c:(.text+0x104): undefined reference to stdscr' ttyclock.c:(.text+0x111): undefined reference tokeypad'
ttyclock.c:(.text+0x116): undefined reference to start_color' ttyclock.c:(.text+0x120): undefined reference tocurs_set'
ttyclock.c:(.text+0x127): undefined reference to stdscr' ttyclock.c:(.text+0x12f): undefined reference towclear'
ttyclock.c:(.text+0x134): undefined reference to use_default_colors' ttyclock.c:(.text+0x16a): undefined reference toinit_pair'
ttyclock.c:(.text+0x18e): undefined reference to init_pair' ttyclock.c:(.text+0x1b2): undefined reference toinit_pair'
ttyclock.c:(.text+0x1b9): undefined reference to stdscr' ttyclock.c:(.text+0x1c1): undefined reference towrefresh'
ttyclock.c:(.text+0x399): undefined reference to newwin' ttyclock.c:(.text+0x3e9): undefined reference towborder'
ttyclock.c:(.text+0x41b): undefined reference to wattr_on' ttyclock.c:(.text+0x4ac): undefined reference tonewwin'
ttyclock.c:(.text+0x4fc): undefined reference to wborder' ttyclock.c:(.text+0x51b): undefined reference toclearok'
ttyclock.c:(.text+0x533): undefined reference to stdscr' ttyclock.c:(.text+0x540): undefined reference tonodelay'
ttyclock.c:(.text+0x564): undefined reference to wrefresh' ttyclock.c:(.text+0x57a): undefined reference towrefresh'
/tmp/ccky1p0y.o: In function signal_handler': ttyclock.c:(.text+0x5b6): undefined reference toendwin'
ttyclock.c:(.text+0x5d1): undefined reference to endwin' /tmp/ccky1p0y.o: In functioncleanup':
ttyclock.c:(.text+0x623): undefined reference to delscreen' /tmp/ccky1p0y.o: In functiondraw_number':
ttyclock.c:(.text+0x9c1): undefined reference to wattr_on' ttyclock.c:(.text+0x9e3): undefined reference towattr_off'
ttyclock.c:(.text+0xa29): undefined reference to wbkgdset' ttyclock.c:(.text+0xa47): undefined reference towmove'
ttyclock.c:(.text+0xa67): undefined reference to waddch' ttyclock.c:(.text+0xa8f): undefined reference towrefresh'
/tmp/ccky1p0y.o: In function draw_clock': ttyclock.c:(.text+0xb1f): undefined reference towbkgdset'
ttyclock.c:(.text+0xb3f): undefined reference to wmove' ttyclock.c:(.text+0xb64): undefined reference towaddnstr'
ttyclock.c:(.text+0xb84): undefined reference to wmove' ttyclock.c:(.text+0xba9): undefined reference towaddnstr'
ttyclock.c:(.text+0xc13): undefined reference to wattr_on' ttyclock.c:(.text+0xc35): undefined reference towattr_off'
ttyclock.c:(.text+0xc5e): undefined reference to wbkgdset' ttyclock.c:(.text+0xc94): undefined reference tomvwprintw'
ttyclock.c:(.text+0xcaa): undefined reference to wrefresh' ttyclock.c:(.text+0xcd7): undefined reference towbkgdset'
ttyclock.c:(.text+0xcf7): undefined reference to wmove' ttyclock.c:(.text+0xd1c): undefined reference towaddnstr'
ttyclock.c:(.text+0xd3c): undefined reference to wmove' ttyclock.c:(.text+0xd61): undefined reference towaddnstr'
/tmp/ccky1p0y.o: In function clock_move': ttyclock.c:(.text+0xdd1): undefined reference towbkgdset'
ttyclock.c:(.text+0xe0c): undefined reference to wborder' ttyclock.c:(.text+0xe26): undefined reference towerase'
ttyclock.c:(.text+0xe3c): undefined reference to wrefresh' ttyclock.c:(.text+0xe69): undefined reference towbkgdset'
ttyclock.c:(.text+0xea4): undefined reference to wborder' ttyclock.c:(.text+0xebe): undefined reference towerase'
ttyclock.c:(.text+0xed4): undefined reference to wrefresh' ttyclock.c:(.text+0xf0c): undefined reference tomvwin'
ttyclock.c:(.text+0xf44): undefined reference to wresize' ttyclock.c:(.text+0xfcb): undefined reference tomvwin'
ttyclock.c:(.text+0x1000): undefined reference to wresize' ttyclock.c:(.text+0x1049): undefined reference towborder'
ttyclock.c:(.text+0x1096): undefined reference to wborder' ttyclock.c:(.text+0x10b0): undefined reference towrefresh'
ttyclock.c:(.text+0x10c6): undefined reference to wrefresh' /tmp/ccky1p0y.o: In functionclock_rebound':
ttyclock.c:(.text+0x1112): undefined reference to LINES' ttyclock.c:(.text+0x1167): undefined reference toCOLS'
/tmp/ccky1p0y.o: In function set_second': ttyclock.c:(.text+0x123e): undefined reference toCOLS'
/tmp/ccky1p0y.o: In function set_center': ttyclock.c:(.text+0x12d0): undefined reference toCOLS'
ttyclock.c:(.text+0x12f8): undefined reference to LINES' /tmp/ccky1p0y.o: In functionset_box':
ttyclock.c:(.text+0x135b): undefined reference to wbkgdset' ttyclock.c:(.text+0x1376): undefined reference towbkgdset'
ttyclock.c:(.text+0x13a3): undefined reference to wbkgdset' ttyclock.c:(.text+0x13be): undefined reference towbkgdset'
ttyclock.c:(.text+0x13f9): undefined reference to wborder' ttyclock.c:(.text+0x1438): undefined reference towborder'
ttyclock.c:(.text+0x1479): undefined reference to wborder' ttyclock.c:(.text+0x14b8): undefined reference towborder'
ttyclock.c:(.text+0x14d2): undefined reference to wrefresh' ttyclock.c:(.text+0x14e8): undefined reference towrefresh'
/tmp/ccky1p0y.o: In function key_event': ttyclock.c:(.text+0x152a): undefined reference tostdscr'
ttyclock.c:(.text+0x1532): undefined reference to wgetch' ttyclock.c:(.text+0x15aa): undefined reference toinit_pair'
ttyclock.c:(.text+0x15c7): undefined reference to init_pair' ttyclock.c:(.text+0x15dd): undefined reference tostdscr'
ttyclock.c:(.text+0x15e5): undefined reference to wgetch' ttyclock.c:(.text+0x1670): undefined reference toLINES'
ttyclock.c:(.text+0x173d): undefined reference to COLS' ttyclock.c:(.text+0x1921): undefined reference toinit_pair'
ttyclock.c:(.text+0x193e): undefined reference to init_pair' /tmp/ccky1p0y.o: In functionmain':
ttyclock.c:(.text+0x1d8d): undefined reference to stdscr' ttyclock.c:(.text+0x1d9f): undefined reference towattr_on'
ttyclock.c:(.text+0x1dc7): undefined reference to `endwin'
collect2: error: ld returned 1 exit status
Makefile:22: recipe for target 'tty-clock' failed
make: *** [tty-clock] Error 1

[dave@manjaro tty-clock-master :( ]$

Leading zero is always output, even for 12-hour display

The large clock always outputs leading zero, even when 12 hour display is selected. In the United States it is customary to omit this digit when displaying the time in 12-hour format. Most users in this region expect the time to look like '%l:%M %p

This line should be conditional on 24-hour mode or a value >9.

draw_number(ttyclock.date.hour[0], 1, 1);

init scripts

please add templates to run tty-clock on selected vt at boottime

cant compile in cygwin

build ttyclock.c
CC ttyclock.c
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0xa7): undefined reference to newterm' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0xea): undefined reference to set_term'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0xf1): undefined reference to initscr' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0xf6): undefined reference to cbreak'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0xfb): undefined reference to noecho' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0x100): undefined reference to ncwrap_stdscr'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0x110): undefined reference to keypad' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0x115): undefined reference to start_color'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0x121): undefined reference to curs_set' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0x126): undefined reference to ncwrap_stdscr'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0x12e): undefined reference to wclear' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0x133): undefined reference to use_default_colors'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0x16b): undefined reference to init_pair' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0x193): undefined reference to init_pair'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0x1bb): undefined reference to init_pair' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0x1c0): undefined reference to ncwrap_stdscr'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0x1c8): undefined reference to wrefresh' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0x379): undefined reference to newwin'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0x3de): undefined reference to wborder' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0x40d): undefined reference to wattr_on'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0x48b): undefined reference to newwin' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0x4f0): undefined reference to wborder'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0x50b): undefined reference to clearok' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0x520): undefined reference to ncwrap_stdscr'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0x530): undefined reference to nodelay' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0x54f): undefined reference to wrefresh'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0x562): undefined reference to wrefresh' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0x596): undefined reference to endwin'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0x5af): undefined reference to endwin' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0x608): undefined reference to delscreen'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0x93f): undefined reference to wattr_on' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0x964): undefined reference to wattr_off'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0x9a1): undefined reference to wbkgdset' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0x9c2): undefined reference to wmove'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0x9e2): undefined reference to waddch' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0xa07): undefined reference to wrefresh'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0xa97): undefined reference to wbkgdset' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0xaba): undefined reference to wmove'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0xae2): undefined reference to waddnstr' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0xb05): undefined reference to wmove'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0xb2d): undefined reference to waddnstr' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0xb9c): undefined reference to wattr_on'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0xbc1): undefined reference to wattr_off' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0xbe8): undefined reference to wbkgdset'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0xc17): undefined reference to mvwprintw' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0xc2a): undefined reference to wrefresh'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0xc54): undefined reference to wbkgdset' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0xc77): undefined reference to wmove'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0xc9f): undefined reference to waddnstr' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0xcc2): undefined reference to wmove'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0xcea): undefined reference to waddnstr' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0xd50): undefined reference to wbkgdset'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0xda3): undefined reference to wborder' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0xdb6): undefined reference to werase'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0xdc9): undefined reference to wrefresh' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0xdf4): undefined reference to wbkgdset'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0xe47): undefined reference to wborder' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0xe5a): undefined reference to werase'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0xe6d): undefined reference to wrefresh' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0xea4): undefined reference to mvwin'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0xedb): undefined reference to wresize' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0xf53): undefined reference to mvwin'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0xf87): undefined reference to wresize' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0xfe6): undefined reference to wborder'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0x1045): undefined reference to wborder' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0x1058): undefined reference to wrefresh'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0x106b): undefined reference to wrefresh' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0x10af): undefined reference to ncwrap_LINES'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0x10f5): undefined reference to ncwrap_COLS' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0x11c2): undefined reference to ncwrap_COLS'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0x1253): undefined reference to ncwrap_COLS' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0x1278): undefined reference to ncwrap_LINES'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0x12e2): undefined reference to wbkgdset' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0x12fd): undefined reference to wbkgdset'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0x1328): undefined reference to wbkgdset' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0x1343): undefined reference to wbkgdset'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0x1396): undefined reference to wborder' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0x13e9): undefined reference to wborder'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0x1441): undefined reference to wborder' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0x1494): undefined reference to wborder'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0x14a7): undefined reference to wrefresh' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0x14ba): undefined reference to wrefresh'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0x14ef): undefined reference to ncwrap_stdscr' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0x14f7): undefined reference to wgetch'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0x1571): undefined reference to init_pair' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0x1594): undefined reference to init_pair'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0x15a8): undefined reference to ncwrap_stdscr' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0x15b0): undefined reference to wgetch'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0x1637): undefined reference to ncwrap_LINES' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0x1706): undefined reference to ncwrap_COLS'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0x18e3): undefined reference to init_pair' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0x1906): undefined reference to init_pair'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0x1d40): undefined reference to ncwrap_stdscr' /tmp/ccdQcYBA.o:ttyclock.c:(.text+0x1d58): undefined reference to wattr_on'
/tmp/ccdQcYBA.o:ttyclock.c:(.text+0x1d7e): undefined reference to `endwin'
collect2: error: ld returned 1 exit status
make: *** [Makefile:24: tty-clock] Error 1

Date formatting options (-f)

I was wondering if you wouldn't mind editing the --help output to clarify how to change the date formatting.

I have tried a number of different ways, but each time I get a segmentation fault.

Thanks for the great clock :D

Fixed segfault with now non-working -f option.

From 73584bd10bdcdf358c2a8ceba76048763ee8b378 Mon Sep 17 00:00:00 2001
From: Guenter Knauf 
Date: Thu, 4 Nov 2010 10:37:18 +0100
Subject: [PATCH 1/3] Fixed segfault with now non-working -f option.

The commit to add the -d option broke getopt for -f taking an argument.

---
 ttyclock.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ttyclock.c b/ttyclock.c
index 8fa2306..3a7122c 100644
--- a/ttyclock.c
+++ b/ttyclock.c
@@ -420,7 +420,7 @@ main(int argc, char **argv)
      /* Default delay */
      ttyclock->option.delay = 40000000; /* 25FPS */
 
-     while ((c = getopt(argc, argv, "tvsrcihfd:C:")) != -1)
+     while ((c = getopt(argc, argv, "tvsrcihf:d:C:")) != -1)
      {
           switch(c)
           {
-- 
1.7.2.2

Aligned delay mode: 0, delay*1, delay*2, … as in e.g. 0, 15, 30, 45, 0, …

Current Delay Feature

  • -d delay is cool if you want increments other than the default 1sec.

Only downside

  • If you want to achieve e.g. increments in 5secs that are nicely "aligned" on the 5 number series, e.g. 22:17:00, 22:17:05, 22:17:10, … you have to achieve this by starting at the right time. Not so easy to get that right manually.
  • If you start it regardless of that it simply takes the current time and increments, so e.g. 22:17:02, 22:17:07, 22:17:12.

I propose an "aligned delay" mode

  • It creates a number series: 0, delay, delay*2, delay*3, … until number generation hits 60.
  • When you start tty-clock into that "aligned delay mode" and is yet "unaligned" (e.g. 22:17:02) the clock instead starts with 22:17:0_ with the _ part denoting that it waits for the next "clean entry point".
  • As soon as it reaches any number in the desired number series, it starts there, so e.g. 22:17:05 and from then on "runs aligned".

Would love to see that feature!

Flag ideally would be -D delay

  • As a modified version of -d
  • But sadly -D is already takes for "Hide Date".
  • Maybe you want to break backwards compatibility.
  • Maybe an extra "aligned" flag. But -a is also already taken. So maybe -A. Or something else.

Co-ordinate order should be reversed

X in code is the Y on screen!

In the current version of tty-clock, the x variable represents the y axis on the Cartesian plain.
Even the ttyclock.geo.x changes the position of the clock on the y axis.

This should be changed so that the x variable is a value on the x axis

Question: start with crontab?

Hi!

I have a question, hopefully easy to answer to you.

I use an old laptop as internetradio. I have installed ubuntu 20.04 server with autologin. I start the radio with "mpc play 1" in a script started by the crontab (@reboot). That works fine.

However I want start the tty-clock after the radio. I use "tty-clock -s -c" but it do not start. When I start the script by "./script.sh" it works.

Have anyone an idea?

[sugestion] Force python3, (and maybe change installation path)

When I try to execute the program using python2 (2.7.16) I get the following error:
File "./tty-countdown", line 94
print(center(asciiFormat(t, font), getTermDimensions()), end="")
^
SyntaxError: invalid syntax

Since the program can only be executed with python3, I suggest you to force python3 by changing the first line of the script to #!/usr/bin/python3.

Also, I find better to install programs on .local/bin and .local/bin/share, but thats up to personal preference.

full screen redraw

Could you add an option for fullscreen redraw.

To reproduce you can run x-clock and echo qwe > /dev/prs/X from another terminal.

Changed default date format.

From 90c9ed5f001fc439ee05e45b06eaa4adc51d4658 Mon Sep 17 00:00:00 2001
From: Guenter Knauf 
Date: Thu, 4 Nov 2010 10:41:53 +0100
Subject: [PATCH 2/3] Changed default date format.

In order to avoid mixing up day and month its better to use %F
(the ISO 8601 date format) to be more international understandable.

---
 ttyclock.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ttyclock.c b/ttyclock.c
index 3a7122c..19a9d27 100644
--- a/ttyclock.c
+++ b/ttyclock.c
@@ -414,7 +414,7 @@ main(int argc, char **argv)
      /* Date format */
      ttyclock->option.format = malloc(sizeof(char) * 100);
      /* Default date format */
-     strncpy(ttyclock->option.format, "%d/%m/%Y", 100);
+     strncpy(ttyclock->option.format, "%F", 100);
      /* Default color */
      ttyclock->option.color = COLOR_GREEN; /* COLOR_GREEN = 2 */
      /* Default delay */
-- 
1.7.2.2

Add configuration support

I installed tty-clock on my system (Endeavour OS) which uses custom color schemes, and i noticed that tty-clock does not use these system-defined colors, but rather hardcoded ones.
I would love for some level of configuration to be possible, for example, passing CLI options through the config file instead of the terminal, or use custom color schemes.

LC_TIME ignored ?

$ locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

$ date
Sat 08 May 2021 04:22:50 AM CEST
$ LC_TIME="fr_FR.UTF-8" date
sam. 08 mai 2021 04:25:13 CEST
$ LC_TIME="fr_FR.UTF-8" tty-clock -f"%A %B"
Output :
Saturday May

AM/PM displayed incorrectly for 12:00 - 12:59

Hello,

This is on a Debian 9 system. I also made a Virtualbox VM running Debian 9 as well as I can't change the time on the production system without causing issues. Both systems exhibit this behavior.

Both systems timezone is EDT, and system time is set to this as well. I noticed that after 1:00pm (13:00), "PM" is displayed correctly. It just seems that from noon - 12:59 that tty-clock shows "AM" when the -t argument is present.

vom@debian9-test:~$ date +"%c"
Sun 25 Aug 2019 12:31:50 PM EDT

Screen Shot 2019-08-25 at 1 42 18 PM

Exact command line for that screenshot was tty-clock -s -x -C 6 -t

Let me know if there's any other system/environment information you need. Thanks.

-T option and cron's lack of tty

Does tty-clock really require a tty when using the -T option?

I have the following line on a cron script:

tty-clock -S -c -t -d 3 -T /dev/tty1

And it doesn't work because cron doesn't have a tty, but it's not really required because I'm sending it to /dev/tty1.

Tell me if I'm wrong...

Date format becomes misaligned when the day changes

After midnight, the date format at the bottom becomes misaligned due to it not taking up the same amount of space any more. I can reliably recreate this bug by waiting until midnight and seeing the format get changed.

The date format I am using is %A %B %d, %Y.

Here are some pictures of the bug:
1454141059
1454450886
1454486413
1454746968
1454843679
1455091243
tty-clock-bug

bad seconds handling

tty-clock shows wrong seconds as they are not synchronous:

vokoscreen-2019-05-24_05-20-03

compare with xclock:
vokoscreen-2019-05-24_05-16-25

Collaborators

I'd like propose an idea to @xorg62 after seeing a couple of long standing and already resolved issues still left open, also @anarcat seems to be on top of them, and staying through all these years.

@xorg62 would you like to have a co-maintainer/collaborator to help you out? If you would, I am nominating @anarcat.

Disclaimer: I do not know @anarcat or have not read much of the codes.

New option for time zone

I like how there's already the -u option to get the clock to show UTC. How about another option to define a time zone, relative to UTC? E.g. -z +2:00, to be able to show CEST even without having the computer clock set to this time zone.

Along with #51, this would allow for awesome World Clock monitors, with multiple clocks showing the time in New York, London, Tokyo, etc. -- or any list of cities relevant for yourself or your business.

tty-clock is licensed under... what ?

Hi,
I would like to package tty-clock for openSUSE but couldn't find a LICENCE file or any information about it. tty-clock Debian's package show a "Copyright with condition" in the Copyright file, so what would be the appropriate term to put in my rpm spec file ?
Thank you.

Added -d to program usage outout and to README.

From 6d2993057c919b8479688d92d94d7653913a067d Mon Sep 17 00:00:00 2001
From: Guenter Knauf 
Date: Thu, 4 Nov 2010 10:49:22 +0100
Subject: [PATCH 3/3] Added -d to program usage outout and to README.

---
 README     |    3 ++-
 ttyclock.c |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/README b/README
index e18294d..62d1726 100755
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-usage : tty-clock [-sctrvih] [-C [0-7]] [-f format]
+usage : tty-clock [-sctrvih] [-C [0-7]] [-f format] [-d delay]
     -s            Show seconds
     -c            Set the clock at the center of the terminal
     -C [0-7]      Set the clock color
@@ -8,3 +8,4 @@ usage : tty-clock [-sctrvih] [-C [0-7]] [-f format]
     -v            Show tty-clock version
     -i            Show some info about tty-clock
     -h            Show this page
+    -d delay      Set the delay between two redraws of the clock
diff --git a/ttyclock.c b/ttyclock.c
index 19a9d27..1a8daee 100644
--- a/ttyclock.c
+++ b/ttyclock.c
@@ -426,7 +426,7 @@ main(int argc, char **argv)
           {
           case 'h':
           default:
-               printf("usage : tty-clock [-sctrvih] [-C [0-7]] [-f format]              \n"
+               printf("usage : tty-clock [-sctrvih] [-C [0-7]] [-f format] [-d delay]   \n"
                       "    -s            Show seconds                                   \n"
                       "    -c            Set the clock at the center of the terminal    \n"
                       "    -C [0-7]      Set the clock color                            \n"
-- 
1.7.2.2

AM/PM is not always correct

Yesterday I was seeing correct value for field [AM]/[PM]. But then I didn't check at this hour of the day... Compare the correct time from my desktop at top right of the screen and what tty-clock reports. Also, the print for '%a, %d %b %Y %z' string seems to be off center.

tty-clock -ct -f '%a, %d %b %Y %z'

Screen Shot 2021-07-27 at 12 02 07 PM

Undefined Symbol(s)?

➜ tty-clock git:(master) make
build ttyclock.c
CC ttyclock.c
Undefined symbols for architecture x86_64:
"_COLS", referenced from:
_set_center in ttyclock-bc2903.o
_clock_rebound in ttyclock-bc2903.o
_set_second in ttyclock-bc2903.o
_key_event in ttyclock-bc2903.o
"_LINES", referenced from:
_set_center in ttyclock-bc2903.o
_clock_rebound in ttyclock-bc2903.o
_key_event in ttyclock-bc2903.o
"_cbreak", referenced from:
_init in ttyclock-bc2903.o
"_clearok", referenced from:
_init in ttyclock-bc2903.o
"_curs_set", referenced from:
_init in ttyclock-bc2903.o
"_delscreen", referenced from:
_cleanup in ttyclock-bc2903.o
"_endwin", referenced from:
_signal_handler in ttyclock-bc2903.o
_main in ttyclock-bc2903.o
"_init_pair", referenced from:
_init in ttyclock-bc2903.o
_key_event in ttyclock-bc2903.o
"_initscr", referenced from:
_init in ttyclock-bc2903.o
"_keypad", referenced from:
_init in ttyclock-bc2903.o
"_mvwin", referenced from:
_clock_move in ttyclock-bc2903.o
"_mvwprintw", referenced from:
_draw_clock in ttyclock-bc2903.o
"_newterm", referenced from:
_init in ttyclock-bc2903.o
"_newwin", referenced from:
_init in ttyclock-bc2903.o
"_nodelay", referenced from:
_init in ttyclock-bc2903.o
"_noecho", referenced from:
_init in ttyclock-bc2903.o
"_set_term", referenced from:
_init in ttyclock-bc2903.o
"_start_color", referenced from:
_init in ttyclock-bc2903.o
"_stdscr", referenced from:
_init in ttyclock-bc2903.o
_key_event in ttyclock-bc2903.o
_main in ttyclock-bc2903.o
"_use_default_colors", referenced from:
_init in ttyclock-bc2903.o
"_waddch", referenced from:
_draw_number in ttyclock-bc2903.o
"_waddnstr", referenced from:
_draw_clock in ttyclock-bc2903.o
"_wattr_off", referenced from:
_draw_number in ttyclock-bc2903.o
_draw_clock in ttyclock-bc2903.o
"_wattr_on", referenced from:
_init in ttyclock-bc2903.o
_draw_number in ttyclock-bc2903.o
_draw_clock in ttyclock-bc2903.o
_main in ttyclock-bc2903.o
"_wbkgdset", referenced from:
_draw_number in ttyclock-bc2903.o
_draw_clock in ttyclock-bc2903.o
_clock_move in ttyclock-bc2903.o
_set_box in ttyclock-bc2903.o
"_wborder", referenced from:
_init in ttyclock-bc2903.o
_clock_move in ttyclock-bc2903.o
_set_box in ttyclock-bc2903.o
"_wclear", referenced from:
_init in ttyclock-bc2903.o
"_werase", referenced from:
_clock_move in ttyclock-bc2903.o
"_wgetch", referenced from:
_key_event in ttyclock-bc2903.o
"_wmove", referenced from:
_draw_number in ttyclock-bc2903.o
_draw_clock in ttyclock-bc2903.o
"_wrefresh", referenced from:
_init in ttyclock-bc2903.o
_draw_number in ttyclock-bc2903.o
_draw_clock in ttyclock-bc2903.o
_clock_move in ttyclock-bc2903.o
_set_box in ttyclock-bc2903.o
"_wresize", referenced from:
_clock_move in ttyclock-bc2903.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [tty-clock] Error 1

On OS X in iTerm2. I'm not very advanced so this may be a simple dependency that I'm missing, but help pointing me in the right direction here would be appreciated.

[suggestion] Option to display weekday

I have TTY-clock running on various TVs around my house and it is my primary way of telling the time of day when I'm not either outside (with my phone) or working at a desktop (when I use other clocks)

One feature TTY-clock lacks that my other clocks have, is that it does not tell me the day of the week, even though it displays the date. I have to consult a calendar if I want to know what day it is. It would be really nice if TTY-clock could have an option display a three letter day of the week abbreviation (MON TUE WEN THU FRI SAT SUN) to the left of the time, similar to how there is an option to display seconds on the right side.

Countdown feature.

Would be awesome to specify a time or date and have the clock count down.

make new release(s) and synchronise with existing tags

Hello!

I am the maintainer of the debian package, and along with @carla-v, we have worked on making "real" releases of tty-clock, which is quite useful for the debian package. The @carla-v tree is already at 2.0:

https://github.com/carla-v/tty-clock/releases

The debian package also followed that naming convention:

http://packages.qa.debian.org/t/tty-clock.html

It seems that there was new development here, and I would be fine to consider this upstream again, however to keep some consistency on our side, it would be nice if there would be a (say) 3.0 (or anything greater than 2.0) release that would encompass the new changes in the code.

Is that something that could be considered?

Thanks.

tty-clock is late

When compared with other software, tty-clock seems actually to run one or two seconds late.

snap-2017 01 13-10 27 23

In the above screenshot, 4 clocks are running, from top to bottom:

  1. xmobar (the status bar of xmonad)
  2. xclock -d -update 1
  3. vtclock -v -3 (nothing special about those flags, just a nicer font)
  4. tty-clock -s

Note that we don't see it in the screenshot, but xmobar is actually lagging a little behind the other two clocks, say about 500ms. Here's a screencast that shows the behavior more precisely.

I find it mind-boggling that 4 clocks can't agree on the time on my computer, this gotta have some profound meaning involving long hair and swiss patent offices, but i am not certain... ;)

Localization

Please add locale support. (weekday name for example)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.