sub get_rand_time_str()

in t/modules/expires.t [146:184]


sub get_rand_time_str {
    my $a_m = shift;
    my ($y, $m, $w, $d, $h, $mi, $s, $rand_time_str);
    $y = int(rand(2));
    $m = int(rand(4));
    $w = int(rand(3));
    $d = int(rand(20));
    $h = int(rand(9));
    $mi = int(rand(50));
    $s = int(rand(50));
    my $gmsec = calculate_seconds($y,$m,$w,$d,$h,$mi,$s);

    ## whether to write it out or not ##
    if (int(rand(2))) {
        ## write it out ##

        ## access or modification ##
        if ($a_m eq 'A') {
            $rand_time_str = "\"access plus";
        } else {
            $rand_time_str = "\"modification plus";
        }

        $rand_time_str .= " $y years"    if $y;
        $rand_time_str .= " $m months"   if $m;
        $rand_time_str .= " $w weeks"    if $w;
        $rand_time_str .= " $d days"     if $d;
        $rand_time_str .= " $h hours"    if $h;
        $rand_time_str .= " $mi minutes" if $mi;
        $rand_time_str .= " $s seconds"  if $s;
        $rand_time_str .= "\"";
        
    } else {
        ## easy format ##
        $rand_time_str = "$a_m$gmsec";
    }

    return ($gmsec, $rand_time_str);
}