Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,18 @@
|
|||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub compound_duration {
|
||||
my $sec = shift;
|
||||
no warnings 'numeric';
|
||||
|
||||
return join ', ', grep { $_ > 0 }
|
||||
int($sec/60/60/24/7) . " wk",
|
||||
int($sec/60/60/24) % 7 . " d",
|
||||
int($sec/60/60) % 24 . " hr",
|
||||
int($sec/60) % 60 . " min",
|
||||
int($sec) % 60 . " sec";
|
||||
}
|
||||
|
||||
for (7259, 86400, 6000000) {
|
||||
printf "%7d sec = %s\n", $_, compound_duration($_)
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
use strict;
|
||||
use warnings;
|
||||
use Math::AnyNum 'polymod';
|
||||
|
||||
sub compound_duration {
|
||||
my $seconds = shift;
|
||||
my @terms;
|
||||
|
||||
my @durations = reverse polymod($seconds, 60, 60, 24, 7);
|
||||
my @timespans = <wk d hr min sec>;
|
||||
while (my $d = shift @durations, my $t = shift @timespans) {
|
||||
push @terms, "$d $t" if $d
|
||||
}
|
||||
join ', ', @terms
|
||||
}
|
||||
|
||||
for (<7259 86400 6000000 3380521>) {
|
||||
printf "%7d sec = %s\n", $_, compound_duration($_)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue