I have posted before....but i'm still working on this.
$row
3 is start minute
$row
5 is end minute
All i need to do is round the minutes for each
Join the start hour to the start minute and
the end hour to the end minute. then subtract the end time
from the start time to get a total elapsed time (rounded of course)
I just can't seem to get a total.
################ BEGIN TIME TOTALING SUBROUTINE
sub calc_total{
# HAVE TO CONVERT TIME INPUT
if ($row[3] >= 52.5) {$start_minute = 1.0 ;}
elsif ($row[3] >= 37.5) {$start_minute = .75 ;}
elsif ($row[3] >= 22.5) {$start_minute = .5 ;}
elsif ($row[3] >= 7.5) {$start_minute = .25 ;}
else {$row[3] = .0 ;}
if ($row[5] >= 52.5) {$end_minute = 1.0 ;}
elsif ($row[5] >= 37.5) {$end_minute = .75 ;}
elsif ($row[5] >= 22.5) {$end_minute = .5 ;}
elsif ($row[5] >= 7.5) {$end_minute = .25 ;}
else {$row[5] = .0 ;}
$start_total = $row[2] + $start_minute;
$end_total = $row[4] + end_minute;
$total_time = $end_total - $start_total;
}
################ END TIME TOTALING SUBROUTINE
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.