From: b Date: Sat, 7 Oct 2023 22:14:03 +0000 (+0000) Subject: generate timer X-Git-Tag: v1.0.0~55 X-Git-Url: http://bicyclesonthemoon.info/git-projects/?a=commitdiff_plain;h=75a27dee94356f3e280d5586c9650e0fe0b4c808;p=botm%2Foldlogs generate timer --- diff --git a/bsta_lib.1.pm b/bsta_lib.1.pm index 5697e6b..2bcf82e 100644 --- a/bsta_lib.1.pm +++ b/bsta_lib.1.pm @@ -754,10 +754,38 @@ sub print_viewer_page { my $access = $context->{'access'}; my $password_ok = $context->{'password_ok'}; my $text_mode = $context->{'text_mode'} + my $static = $context->{'static'}; + + my $timer_unlocked = int($context->{'timer_unlocked'}); + my $timer = int($context->{'timer'}; my $last_frame = int($state->{'last'}); my $ong_state = int($state->{'state'}); + my $timer_color_h = (($timer_unlocked >= 1) || ($ong_state >= STATE->{'ready'})) ? 'br' : 'ni'; + my $timer_color_m = (($timer_unlocked >= 2) || ($ong_state >= STATE->{'ready'})) ? 'br' : 'ni'; + my $timer_color_s = (($timer_unlocked >= 3) || ($ong_state >= STATE->{'ready'})) ? 'br' : 'ni'; + + my $timer_h; + my $timer_m; + my $timer_s; + if ($timer > 0) { + $timer_s = sprintf('%02d', $timer % 60); + $timer_h = int($timer / 60); + $timer_m = sprintf('%02d', $timer_h % 60); + $timer_h = sprintf('%02d', $timer_h / 60); + } + elsif (($timer >= -15) && ($ong_state >= STATE->{'ready'})) { + $timer_h = '00'; + $timer_m = '00'; + $timer_s = 'NG'; + } + else { + $timer_h = 'EE'; + $timer_m = 'EE'; + $timer_s = 'EE'; + } + my $prev_available = (($frame > 0) && $access'); my $next_available = ($password_ok' || ($next_frame <= $last_frame)); my $prefetch_next = ( @@ -830,7 +858,7 @@ sub print_viewer_page { $frame_url = $frame_indirect ? merge_url( {'path' => CGI_FRAME_PATH()}, - {'path' => $context->{'frame'}} + {'path' => $frame} ) : $frame_normal_url; $frame_full_url = merge_url( @@ -959,7 +987,12 @@ sub print_viewer_page { } print $fh '
'."\n"; - # TODO + + if ($show_timer) { + print $fh '['.$timer_h.''; + print $fh ':'.$timer_m.''; + print $fh ':'.$timer_s.']'; + } print_html_body_end($fh); print_html_end($fh);