NAME
Time::Decimal -- Handle french revolutionary ten hour days
SYNOPSIS
use Time::Decimal qw($precision h24s_h10 h24_h10 h10s_h24 h10_h24
transform now_h10 loop);
$precision = 'ms';
$dec = h24s_h10( 1234.5678 );
$dec = h24_h10( 13, 23, 45, 345_678 );
$bab = h10s_h24( 1234.5678 );
$bab = h10_h24( 1, 50, 75, 345_678 );
$dec = transform( '13:23' );
$dec = transform( '1:23:45.345_678 pm' );
$bab = transform( '1_50_75.345_678' );
$dec = now_h10;
$dec = now_h10( time + 60 );
$precision = 's';
loop { print "$_[0]\t" . localtime() . "\n" };
or
perl <path>/Time/Decimal.pm [-option ...] [time ...]
ln <path>/Time/Decimal.pm dectime
dectime [-option ...] [time ...]
DESCRIPTION
The Babyloninan 24 hour clock is one of the last complicated vestiges of the pre-decimal age. The french revolution, when it created decimal measures for everything, also invented a division of the day into ten hours of 100 minutes and again 100 seconds each. The nice thing is that seconds and (to a lesser degree) minutes are roughly as long as those we know. Hours are of course more than twice as long.
So as to be able to automatically recognize decimal time, we use _
instead of :
as a separator. This character is usable in many more computer contexts. In Perl it is a possible separator between digits. And that's what it means here, because a decimal time H_MM is nothing else than a three digit number of minutes. The same applies to five digit numbers of seconds.
For the purpose of transformation it doesn't matter whether we see 1:30 as an early morning time, or as a duration of one and a half hours. Thus a time like 84:00 or 35_00 meaning three and a half days is allowed.
Module Interface
Nothing is exported by default, but all of the following may be imported by the use
statement:
- $precision
-
'' minutes (the default) 's' seconds 'ds' deciseconds 'cs' centiseconds 'ms' milliseconds 'µs', 'us' microseconds
Where the µ-sign may be in UTF-8, Latin-1, -3, -5, -7 or Latin-9.
- loop { perlcode }
- See SYNOPSIS above
-
Documentation for the various functions remains to be written.
Command Line Interface
- -s, --seconds
- -d, --ds, --deciseconds
- -c, --cs, --centiseconds
- -m, --ms, --milliseconds
- -u, --us, --microseconds
-
Output times at the given precision, instead of minutes.
- -e, --echo
-
Output the transformed time along with the transformation.
- -r, --reverse
-
Retransform the transformation to see possible loss due to insufficient precision.
- -l, --loop
-
Output the time again each time the result changes at the wanted precision. Can be used as a clock, but if the precision is too small, the terminal emulation may have problems, either flickering or repeatedly stalling (
rxvt
family). - -o, --old, --old-table, --babylonian, --babylonian-table
- -n, --new, --new-table, --decimal, --decimal-table
-
Supplies overviews of about 70 times of common interest each. Implies
--echo
.
SEE ALSO
DateTime::Calendar::FrenchRevolutionary fits nicely into the DateTime hierarchy. Alas that doesn't handle fractions, so they have a lossy transformation. Besides fractions seem even more natural in decimal time.
AUTHOR
Daniel Pfeiffer <occitan@esperanto.org>