#!/usr/bin/perl -w # Blosxom Plugin: warCounter # Author: David Zwarg (david@zwarg.com) # Version: 0.1a # Blosxom Home/Docs/Licensing: http://www.raelity.org/blosxom # Documentation: See the bottom of this file. package warCounter; # --- Configurable Variables --- # Set to whatever you want your HTML to be indented with. my $indent="\t"; # Set to whatever you want the list items to be indented with. my $lvl_1=" \; \;"; # ------------------------------ $AllCounters = ''; $SecondCounter = ''; $MinuteCounter = ''; $HourCounter = ''; $DayCounter = ''; $MonthCounter = ''; $YearCounter = ''; use Time::Local; sub start { return 1; } sub head { my ($pkg, $currentdir, $head_ref)=@_; # march 20th, 2003 is the start of the war # 0234 GMT is the time @war_start = ( 0, 34, 02, 20, 2, 2003 ); $start = timegm( $war_start[0], $war_start[1], $war_start[2], $war_start[3], $war_start[4], $war_start[5] ); # today's date $now = time(); @present = gmtime($now); $sec = $now - $start; $min = ($now - $start)/60; $hrs = ($now - $start)/(60*60); $day = ($now - $start)/(60*60*24); #$yrs = (($present[5] + 1900) - $war_start[5]); $mon = (($present[5] + 1900) - $war_start[5]) * 12 + ($present[4] - $war_start[4]); $yrs = int( $mon / 12 ); $SecondCounter = sprintf "%s%sSeconds: %d", $indent, $lvl_1, $sec; $MinuteCounter = sprintf "%s%sMinutes: %d", $indent, $lvl_1, $min; $HourCounter = sprintf "%s%sHours: %d", $indent, $lvl_1, $hrs; $DayCounter = sprintf "%s%sDays: %d", $indent, $lvl_1, $day; $MonthCounter = sprintf "%s%sMonths: %d", $indent, $lvl_1, $mon; $YearCounter = sprintf "%s%sYears: %d", $indent, $lvl_1, $yrs; $AllCounters = "

\n"; $AllCounters .= $SecondCounter.'
'."\n"; $AllCounters .= $MinuteCounter.'
'."\n"; $AllCounters .= $HourCounter.'
'."\n"; $AllCounters .= $DayCounter.'
'."\n"; $AllCounters .= $MonthCounter.'
'."\n"; $AllCounters .= $YearCounter.'
'."\n"; $AllCounters .= "

\n"; } 1; __END__ =head1 Name warCounter - plugin for Blosxom which calculates the elapsed time since the war has begun in Iraq (March 20, 2003). =head1 Synopsis # display seconds, minutes, hours, days, months, and years $warCounter::AllCounters # display seconds "Seconds: XXXXXX"

$warCounter::SecondCounter

# display minutes "Minutes: XXXXX"

$warCounter::MinuteCounter

# display hours "Hours: XXXX"

$warCounter::HourCounter

# display days "Days: XXX"

$warCounter::DayCounter

# display months "Months: XX"

$warCounter::MonthCounter

# display years "Years: X"

$warCounter::YearCounter

=head1 Description The counters available count from the beginning of the war with Iraq. The date used is 00:00, March 20, 2003. The variable AllCounters is a combination of the other counters, and contains paragraph formatting and line breaks. =head1 Download The source is available here: L =head1 Note The other counter variables are all from the beginning of the war. Each time denomination is the total timer. No attempt is made to display the time in HH:MM:SS format. =head1 Author David Zwarg david@zwarg.com