#!/usr/bin/perl
$t=0;
$intv=10;

sub roundnum ($) {
    my ($s) = @_;
    return
        $s <    60*2 ? 60 :
        $s <  3600*2 ? 60 :
        $s < 86400*2 ? 3600 :
                       86400;
}

sub conv ($) {
    my ($s) = @_;
    return sprintf "%2dd%2dh%02dm%02ds",
        int($s / 86400), int(($s % 86400) / 3600),
        int(($s % 3600) / 60), $s % 60;
}

for (;;) {
    my $unit= roundnum($t);
    my $r= int($t / $unit) * $unit;
    printf "%8d %s  +%8d %s  R %8d %s  %7d  %5.2f\n",
        $t, conv($t), $intv, conv($intv),
        $r, conv($r), $t-$r, ($t-$r)/$unit;
    $intv= $t*0.01 + 10;
    $t += $intv;
    #$intv *= 1.01;
    #$intv += 5;
}
