1 | 1 | simandl | # |
2 | | | # $Id: HotSaNICdiagram.pm,v 1.3 2004/01/25 05:14:00 bernisys Exp $ |
3 | | | # |
4 | | | |
5 | | | package HotSaNICdiagram; |
6 | | | |
7 | | | ($VERSION = '$Revision: 1.3 $') =~ s/.*(\d+\.\d+).*/$1/; |
8 | | | |
9 | | | my @Weekday=("Sun","Mon","Tue","Wed","Thu","Fri","Sat"); |
10 | | | |
11 | | | ###################################################################### |
12 | | | # |
13 | | | # evaluates some diagram properties from the given range |
14 | | | # |
15 | | | # Usage: |
16 | | | # ($description,$file_description,$build_interval,$diagram_range,$timestring)=get_diagram_properties($range); |
17 | | | # |
18 | | | sub get_diagram_properties { |
19 | | | my ($range)=@_; |
20 | | | my ($descr,$file,$build,$fullrange); |
21 | | | if ($range eq "1h") { $descr="hour"; $file=$descr; $build=0; $fullrange=3600; } |
22 | | | elsif ($range eq "6h") { $descr="6 hours"; $file="6h"; $build=30; $fullrange=21600; } |
23 | | | elsif ($range eq "1day") { $descr="day"; $file=$descr; $build=120; $fullrange=86400; } |
24 | | | elsif ($range eq "1week") { $descr="week"; $file=$descr; $build=1000; $fullrange=604800; } |
25 | | | elsif ($range eq "1month") { $descr="month"; $file=$descr; $build=4300; $fullrange=2592000; } |
26 | | | elsif ($range eq "1year") { $descr="year"; $file=$descr; $build=52500; $fullrange=31536000; } |
27 | 27 | simandl | elsif ($range eq "10year") { $descr="10year"; $file=$descr; $build=525000; $fullrange=315360000; } |
28 | 1 | simandl | |
29 | | | ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); |
30 | | | $year+=1900; |
31 | | | $mon++; |
32 | | | if ($mon<10) { $mon="0".$mon; } |
33 | | | if ($mday<10) { $mday="0".$mday; } |
34 | | | if ($hour<10) { $hour="0".$hour; } |
35 | | | if ($min<10) { $min="0".$min; } |
36 | | | $buildtime="$Weekday[$wday] $year-$mon-$mday $hour:$min"; |
37 | | | |
38 | | | return ($descr,$file,$build,$fullrange,$buildtime); |
39 | | | } |
40 | | | |
41 | | | 1; |
42 | | | |