From: Stephen L Johnson Date: Thu, 27 Jul 2000 03:51:05 +0000 (+0000) Subject: changed date and time display code to use POSIX::strftime() and fmt vars X-Git-Tag: spong-2_7-alpha8^0 X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=673ec3b5843779b064f009cc644a2b06e34ad3cc;p=spong.git changed date and time display code to use POSIX::strftime() and fmt vars --- diff --git a/config/spong.conf b/config/spong.conf index 9725895..8c5addb 100755 --- a/config/spong.conf +++ b/config/spong.conf @@ -12,7 +12,7 @@ $SPONGSLEEP{'DEFAULT'} = 300; # $SPONGSLEEP{'spong-server'} = 120; # values to override the 'DEFAULT' # $SPONGSLEEP{'spong-client'} = 300; # with the named program -$SPONGSERVER = "spong-server.aci.alltel.com"; +$SPONGSERVER = "spong-server.my-ink.com"; $SPONGDB = "/usr/local/spong/var/database"; $SPONGTMP = "/usr/local/spong/tmp"; $SPONG_UPDATE_PORT = 1998; @@ -63,10 +63,10 @@ $WWW_TITLE_ACTIONBAR = ' Extended ActionBar: ' . $WWW_DEFAULT_VIEW = "GROUPS"; # Date and time format strings. These are strftime() format variables -$DATETIMEFMT = "%c"; -$DATEFMT = "%m/%d/%y"; -$TIMEFMT = "%H:%M:%S"; - +$DATEFMT = "%m/%d/%y"; # MM/DD/YY +$TIMEFMT = "%H:%M:%S"; # HH:MM:SS +$TIMEFMTNOSEC = "%H:%M"; # HH:MM +$DATETIMEFMT = "%c"; # scalar localtime() format $WWW_TITLE_COLOR = "#9999ff"; # Background color for table title cells $WWW_CELL_COLOR = "#cccccc"; # Background color for table detail cells diff --git a/config/spong.hosts b/config/spong.hosts index e0a008d..c71d3f3 100755 --- a/config/spong.hosts +++ b/config/spong.hosts @@ -74,4 +74,20 @@ }, ); -1; +# %HOSTS_DEFAULTS is used to establish default configuration values for +# various spong network checks. Any value in the %HOSTS entry will override +# the %HOSTS_DEFAULT value. + +%HOSTS_DEFAULTS = ( +); + +# %HOSTS_ALL is used to define values that will used/checks in the spong +# network checks. %HOST_ALL values are not the same are %HOSTS_DEFAULTS +# entries. A value defined in a %HOST entry will override the same entry +# defined in $HOSTS_DEFAULTS. Values in %HOSTS_ALL are added the list of +# even if there are no values found. + +%HOSTS_ALL = ( +); + +1; # Don't remove me diff --git a/pod/spong.conf.pod b/pod/spong.conf.pod index dea60ab..0db2fc8 100644 --- a/pod/spong.conf.pod +++ b/pod/spong.conf.pod @@ -76,6 +76,29 @@ named F. If set to I<1>, B will log errors to the syslog using the I facility and the I priority. +=item $TIMEFMT + +A string that contains strftime() presentation symbols for formatting time +displays which have hours, minutes and seconds. The default is "%H:%M:%S". + +=item $TIMEFMTNOSEC + +A string that contains strftime() presentation symbols for formatting time +displays which have hours and minutes. The default is "%H:%M". + +=item $DATEFMT + +A string that contains strftime() presentation symbols for formatting date +displays. The default is "%m/%d/%y" (i.e numeric month / numeric day / + year w/o century ). + +=item $DATETIMEFMT + +A string that contains strftime() presentation symbols for formating a full +date and time display. The default is "%c" (preferred date and time +representation for the current locale. And alternate format might be +"$DATEFMT, $TIMEFMT". + =back =head2 spong-server diff --git a/src/lib/Spong/Ack.pm b/src/lib/Spong/Ack.pm index fd38fb5..158a1aa 100755 --- a/src/lib/Spong/Ack.pm +++ b/src/lib/Spong/Ack.pm @@ -90,9 +90,9 @@ sub display_text { print " "x(9-length(substr( $self->services(), 0, 7 ))); if( $d1 == $d2 && $m1 == $m2 && $y1 == $y2 ) { - $date = POSIX::strftime( "%H:%M", localtime($self->end()) ); + $date = POSIX::strftime( $main::TIMEFMTNOSEC, localtime($self->end()) ); } else { - $date = POSIX::strftime( "%D", localtime($self->end()) ); + $date = POSIX::strftime( $main::DATEFMT, localtime($self->end()) ); } print $date, " "x(12-length($date)); diff --git a/src/lib/Spong/HistoryList.pm b/src/lib/Spong/HistoryList.pm index e2b2f70..90d24bb 100755 --- a/src/lib/Spong/HistoryList.pm +++ b/src/lib/Spong/HistoryList.pm @@ -118,7 +118,7 @@ sub display_text { ($format eq "standard" && $event->time() > (time() - 7*$day)) || ($format eq "full" && $event->time() > (time() - 31*$day)) ) { - my $dstr = POSIX::strftime( "%A, %D", localtime($event->time()) ); + my $dstr = POSIX::strftime( "%A, $main::DATEFMT", localtime($event->time()) ); if( $dstr ne $date ) { if( $date ne "" ) { print "\n"; } print "$dstr\n", "-"x78, "\n"; @@ -142,7 +142,7 @@ sub display_html { ($format eq "standard" && $event->time() > (time() - 7*$day)) || ($format eq "full" && $event->time() > (time() - 31*$day)) ) { - my $dstr = POSIX::strftime( "%A, %D", localtime($event->time()) ); + my $dstr = POSIX::strftime( "%A, $main::DATEFMT", localtime($event->time()) ); if( $dstr ne $date ) { if( $date ne "" ) { print "
"; } print "$dstr\n
\n"; diff --git a/src/lib/Spong/Host.pm b/src/lib/Spong/Host.pm index 7d1f050..49fc5bf 100755 --- a/src/lib/Spong/Host.pm +++ b/src/lib/Spong/Host.pm @@ -293,7 +293,7 @@ sub display_problem_text { print " problem: $prob "; if( $summ ) { print "($summ)\n"; } else { print "\n"; } if( $time ) { - print " updated: ", POSIX::strftime( "%H:%M, %D", localtime($time) ); + print " updated: ", POSIX::strftime( "$main::TIMEFMTNOSEC, $main::DATEFMT", localtime($time) ); print "\n"; } print " contact: $human ($email)\n"; @@ -332,7 +332,7 @@ sub display_problem_html { # if( $summ ) { print "$spacer summary: $summ
\n"; } if( $time ) { print "$spacer updated: "; - print POSIX::strftime( "%H:%M, %D", localtime($time) ), "
\n"; + print POSIX::strftime( "$main::TIMEFMTNOSEC, $main::DATEFMT", localtime($time) ), "
\n"; } if ( $main::WWWCONTACT ) { diff --git a/src/lib/Spong/Service.pm b/src/lib/Spong/Service.pm index ff1ba15..f562020 100755 --- a/src/lib/Spong/Service.pm +++ b/src/lib/Spong/Service.pm @@ -217,9 +217,9 @@ sub display_text { print $color, " "x(9-length($color)); if( $d1 == $d2 && $m1 == $m2 && $y1 == $y2 ) { - $date = POSIX::strftime( "%H:%M", localtime($self->rtime()) ); + $date = POSIX::strftime( $main::TIMEFMTNOSEC, localtime($self->rtime()) ); } else { - $date = POSIX::strftime( "%D", localtime($self->rtime()) ); + $date = POSIX::strftime( $main::DATEFMT, localtime($self->rtime()) ); } print $date, " "x(11-length($date)); @@ -281,9 +281,9 @@ sub display_html { print ""; if( $d1 == $d2 && $m1 == $m2 && $y1 == $y2 ) { - print POSIX::strftime( "%H:%M", localtime($self->rtime()) ), " "; + print POSIX::strftime( $main::TIMEFMTNOSEC, localtime($self->rtime()) ), " "; } else { - print POSIX::strftime( "%D", localtime($self->rtime()) ), " "; + print POSIX::strftime( $main::DATEFMT, localtime($self->rtime()) ), " "; } print "\n"; @@ -310,7 +310,7 @@ sub display_html { print "

"; print "Updated: "; - print POSIX::strftime( "%H:%M, %D", localtime($self->rtime()) ); + print POSIX::strftime( "$main::TIMEFMTNOSEC, $main::DATEFMT", localtime($self->rtime()) ); print "
Duration: "; print $self->format_duration($self->stime(),$self->rtime()); diff --git a/src/www-spong.pl b/src/www-spong.pl index 4c2b54b..7ee57fc 100755 --- a/src/www-spong.pl +++ b/src/www-spong.pl @@ -327,7 +327,7 @@ sub commands { &problems( $group ); print "


Group: $gname\n
\n"; - print "Updated at ", POSIX::strftime( "%H:%M, on %D", localtime() ), "\n"; + print "Updated at ", POSIX::strftime( "$TIMEFMTNOSEC, on $DATEFMT", localtime() ), "\n"; &footer(); } @@ -366,7 +366,7 @@ sub ovcommands { print "


"; # print "Group: $gname\n
\n"; - print "Updated at ", POSIX::strftime( "%H:%M, on %D", localtime() ), "\n"; + print "Updated at ", POSIX::strftime( "$TIMEFMTNOSEC, on $DATEFMT", localtime() ), "\n"; &footer(); }