I'd completely forgotten to do this. How about:
#!/usr/bin/perl
use strict;
use Time::HiRes qw( usleep );
my $hex_sec_of_day=0;
my $HEX_SEC = 0.7585069444444;
my $HEX_MS_IN_SEC = $HEX_SEC*1000000;
sub calc_curr_time_as_hex() {
my ($s,$m,$h,@rest)=localtime(time());
# my $s=58;my $m=59;my$h=23; # test data
$hex_sec_of_day = (($s+($m*60)+($h*3600))*$HEX_SEC);
}
calc_curr_time_as_hex();
$|=1;
while(1) {
printf ("\r0x%04x ", $hex_sec_of_day);
$hex_sec_of_day++; # day flips from 0xFFFE to 0x0000, move thi
+s line
# below next line to have midnight as 0xFFF
+F
$hex_sec_of_day=0x0000 if($hex_sec_of_day>0xffff);
usleep($HEX_MS_IN_SEC);
}
|