jablonka.czprosek.czf

hotsanic

Subversion Repositories:
[/] [trunk/] [lib/] [HotSaNICdiagram.pm] - Rev 13 Go to most recent revision

Compare with Previous - Blame - Download


#
# $Id: HotSaNICdiagram.pm,v 1.3 2004/01/25 05:14:00 bernisys Exp $
#

package HotSaNICdiagram;

($VERSION = '$Revision: 1.3 $') =~ s/.*(\d+\.\d+).*/$1/;

my @Weekday=("Sun","Mon","Tue","Wed","Thu","Fri","Sat");

######################################################################
#
# evaluates some diagram properties from the given range
#
# Usage:
#   ($description,$file_description,$build_interval,$diagram_range,$timestring)=get_diagram_properties($range);
#
sub get_diagram_properties {
  my ($range)=@_;
  my ($descr,$file,$build,$fullrange);
  if    ($range eq "1h")     { $descr="hour";    $file=$descr; $build=0;     $fullrange=3600; }
  elsif ($range eq "6h")     { $descr="6 hours"; $file="6h";   $build=30;    $fullrange=21600; }
  elsif ($range eq "1day")   { $descr="day";     $file=$descr; $build=120;   $fullrange=86400; }
  elsif ($range eq "1week")  { $descr="week";    $file=$descr; $build=1000;  $fullrange=604800; }
  elsif ($range eq "1month") { $descr="month";   $file=$descr; $build=4300;  $fullrange=2592000; }
  elsif ($range eq "1year")  { $descr="year";    $file=$descr; $build=52500; $fullrange=31536000; }

  ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
  $year+=1900;
  $mon++;
  if ($mon<10) { $mon="0".$mon; }
  if ($mday<10) { $mday="0".$mday; }
  if ($hour<10) { $hour="0".$hour; }
  if ($min<10) { $min="0".$min; }
  $buildtime="$Weekday[$wday] $year-$mon-$mday $hour:$min";

  return ($descr,$file,$build,$fullrange,$buildtime);
  }

1;


Powered by WebSVN 2.2.1