From: David N. <jud...@ad...> - 2002-10-27 01:47:19
|
$down is a number representing the day of the week for the grid being processed and is assigned in fetchLoop. The logic in make_index looks screwy to me because you will get different results for tomorrow's grid if you get it today then if you get it tomorrow. Also, indices for Saturdays (day 6) go back further than those for Sundays (day 0). This could be fixed by passing days_from_now the epoch time of the grid date (use timelocal to calculate) instead of the current time. Got it? :) David ----- Original Message ----- From: "Mickey Argo" <mi...@ao...> To: <mis...@li...> Sent: Saturday, October 26, 2002 10:03 AM Subject: [misterhouse-users] Get TV Grid Question > > How is $down first defined in get_tv_grid? I just noticed that on the drop > down menus to select another day's page all start on 12 Oct and end on 01 > Nov. I found: > > sub days_from_now > { > #print "days_from_now: Incoming: @_ \n"; > my ($day_time, $days) = @_; > my $day_time2 = $day_time + $days * 60 * 60 * 24; > my ($day, $month, $year, $down) = (localtime($day_time2))[3,4,5,6]; > my $dow = (qw(Sunday Monday Tuesday Wednesday Thursday Friday > Saturday))[$down]; > > $month++; > $year += 1900; > $day = sprintf("%02d", $day); > #print "days_from_now: Returning $day - $month - $year \n"; > return ($dow, $down, $day, $month, $year); > } > > > and > > print OUT "<SELECT NAME=url > onchange=window.open(this.options[this.selectedIndex].value,'main')>\n"; > my $dow_start = -$down - 7; > my $dow_stop = $dow_start + 20; > for my $count ($dow_start .. $dow_stop) { > my ($dow2, $dow2n, $day2, $month2, $year2) = > &days_from_now($day_time, $count); > print OUT "<option value='/" . $parms{db} . "/${day2}_$hour.html'"; > > if ($day2 == $day) { > print OUT " Selected "; > } > print OUT ">$dow2, $month2/$day2\n"; > } > print OUT "</select>\n"; > print OUT "<SELECT NAME=tvtime > onchange=window.open(this.options[this.selectedIndex].value,'main')>\n"; > > Since the drop down menu is starting at 12 Oct, then $down must be defined > as 19 Oct ($down -7 and this can be confirmed with the ending date 20 days > later on 01 Nov) but I just don't know enough about programming and/or Perl > to figure out where/why/how it is getting that date. Anyone want to help > fill my clue bag? > > Mickey Argo > > > > ------------------------------------------------------- > This SF.net email is sponsored by: ApacheCon, November 18-21 in > Las Vegas (supported by COMDEX), the only Apache event to be > fully supported by the ASF. http://www.apachecon.com > ________________________________________________________ > To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365 > |