# hexclock.pl <format>: # Display current time in various formats. # # b zero padded binary integer # c ASCII character # d signed integer # e exponential notation floating point # f decimal notation floting point # o octal integer # p pointer to memory address where time is stored (non-dynamic) # u unsigned integer # x hexadecimal integer (default) use strict; my $fmt = shift ||'x'; $fmt='x' unless ($fmt =~ /[bcdefgopu]/) ; $fmt = "%02$fmt" if ($fmt =~ /[xodu]/) ; $fmt = "%06$fmt" if ($fmt =~ /b/); $fmt = "%0$fmt" if ($fmt !~ /%/); while (1) { my ($h,$m,$s) = split ":",`date +%H:%M:%S:`; printf "\r$fmt : $fmt : $fmt", $h, $m, $s; sleep 1; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: hex clock
by inman (Curate) on Apr 14, 2005 at 16:29 UTC | |
by ysth (Canon) on Apr 14, 2005 at 22:29 UTC | |
by inman (Curate) on Apr 15, 2005 at 09:51 UTC | |
by ciderpunx (Vicar) on Aug 01, 2005 at 16:09 UTC | |
by ciderpunx (Vicar) on Apr 15, 2005 at 14:43 UTC | |
by mulander (Monk) on Aug 15, 2005 at 09:25 UTC |