3
\$\begingroup\$

The Inspiration

The Challenge

I'm tired of seeing the same old-same old clock in my top-right-hand corner of my screen. It's time for a new clock. While the clock clock sated my lack of interesting clock for a little while, it simply will do no longer. Your job: make a better, more interesting clock.

The Rules

Make a clock, provided that:

  • Output is either graphical or directed to STDOUT or equivalent.
  • You do not use ASCII numbers as the output (don't just print out the time).
  • It must run continuously until stopped by closing the window or by CTRL-C or equivalent.
  • It may NOT print out an infinite amount of lines (if using STDOUT).
  • It must be human-readable, in any way.
  • It must be accurate to 1/10th of a second to the system clock, and update with any changes to the system clock (so if I change system settings, it will update to my system clock).
  • Your program cannot exceed 1024 bytes.

Pop-con Objectives

The voters should keep in mind the following:

  • Creativity should be valued above all.

  • The better the explanation, the greater the up-votes.
\$\endgroup\$
  • \$\begingroup\$ You are saying it has to be accurate to 1/10 of a second of the system clock. Do we have to include those in the output or is hh:mm:ss enough? \$\endgroup\$ – Denker Feb 21 '16 at 14:02
  • \$\begingroup\$ @DenkerAffe HH:MM:SS is enough, however, it should be verifiable with the system clock. Debug version would be awesome. :) \$\endgroup\$ – Addison Crump Feb 21 '16 at 14:12
  • 4
    \$\begingroup\$ This has two issues: 1. It must be a human-readable clock is not an objective validity criterion. 2. The primary voting criterion is creativity, making the challenge too broad. \$\endgroup\$ – Dennis Feb 21 '16 at 16:56
  • 3
    \$\begingroup\$ sigh I wish these considerations had been brought up in the sandbox. Oh, well. \$\endgroup\$ – Addison Crump Feb 21 '16 at 17:18
9
\$\begingroup\$

Bash

watch -tn.1 date +%T\|figlet

Yeah, yeah, I know it's not golf (28 bytes!), but I do like the minimalism:

animated gif demo

watch is a tool provided by the procps package that repeatedly runs a command every <specified interval of time> and outputs the updated results. (An example of where this is handy: watch -n.1 ls -lh ~/downloads/foo to view the progress of a download.)

The -t flag for watch represents --no-title, as otherwise it would look like this:

screenshot of watch without -t

The -n 0.1 flag simply means "update every 0.1 seconds."

Then comes the command that we're watching over. First, date +%T prints the date in the desired format (date comes from coreutils):

       %T     time; same as %H:%M:%S

Then this is piped to figlet (unsurprisingly provided by the figlet package), which converts STDIN to ASCII art.

(|  |  _            _   _,            _|   _  
 |  | / \_|  |     /   / |  /|/|     / |  / \_
  \/|/\_/  \/|_/   \__/\/|_/ | |_/   \/|_/\_/ 
   (|                                         

             _/  _/                                      _/                
    _/_/_/  _/  _/        _/_/_/    _/_/    _/  _/_/  _/_/_/_/    _/_/_/   
 _/    _/  _/  _/      _/_/      _/    _/  _/_/        _/      _/_/        
_/    _/  _/  _/          _/_/  _/    _/  _/          _/          _/_/     
 _/_/_/  _/  _/      _/_/_/      _/_/    _/            _/_/  _/_/_/        


        _|                   |    |   |    _)                  
  _ \  |    __ \   _ \  _` | __|  __| __ \  | __ \   _` |  __| 
 (   | __|  |   |  __/ (   | |    |   | | | | |   | (   |\__ \ 
\___/ _|   _|  _|\___|\__,_|\__| \__|_| |_|_|_|  _|\__, |____/ 
                                                   |___/       
                       _                                
    o_|_|_  _|_|_  _  |_o _ | __|_ ._ .__  _ .__.._ _   
\/\/| |_| |  |_| |(/_ | |(_||(/_|_ |_)|(_)(_||(_|| | |o 
                          _|       |       _|           
| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Hmm. Figlet. goes off to run apt-get install figlet I like. \$\endgroup\$ – Addison Crump Feb 21 '16 at 15:54
  • 2
    \$\begingroup\$ Are you sure this doesn't violate the requirement not to print an infinite number of lines? \$\endgroup\$ – Peter Taylor Feb 21 '16 at 16:52

Not the answer you're looking for? Browse other questions tagged or ask your own question.