[interchange-cvs] interchange - heins modified lib/Vend/Interpolate.pm

interchange-core@interchange.redhat.com interchange-core@interchange.redhat.com
Fri Jun 14 09:33:00 2002


User:      heins
Date:      2002-06-14 13:30:05 GMT
Modified:  lib/Vend Interpolate.pm
Log:
	* Add hours=1 parameter to force [time adjust=N00 hours=1] to
	  see the adjust as only hours and not a time zone. If you
	  just set hours to a number, it will work as well.

	* Changed tag doc as well.

Revision  Changes    Path
2.67      +7 -3      interchange/lib/Vend/Interpolate.pm


rev 2.67, prev_rev 2.66
Index: Interpolate.pm
===================================================================
RCS file: /anon_cvs/repository/interchange/lib/Vend/Interpolate.pm,v
retrieving revision 2.66
retrieving revision 2.67
diff -u -r2.66 -r2.67
--- Interpolate.pm	6 Jun 2002 15:58:35 -0000	2.66
+++ Interpolate.pm	14 Jun 2002 13:30:04 -0000	2.67
@@ -1,6 +1,6 @@
 # Vend::Interpolate - Interpret Interchange tags
 # 
-# $Id: Interpolate.pm,v 2.66 2002/06/06 15:58:35 jon Exp $
+# $Id: Interpolate.pm,v 2.67 2002/06/14 13:30:04 mheins Exp $
 #
 # Copyright (C) 1996-2001 Red Hat, Inc. <interchange@redhat.com>
 #
@@ -27,7 +27,7 @@
 require Exporter;
 @ISA = qw(Exporter);
 
-$VERSION = substr(q$Revision: 2.66 $, 10);
+$VERSION = substr(q$Revision: 2.67 $, 10);
 
 @EXPORT = qw (
 
@@ -2464,7 +2464,11 @@
 		my $neg = $opt->{adjust} =~ s/^\s*-\s*//;
 		my $diff;
 		$opt->{adjust} =~ s/^\s*\+\s*//;
-		if($opt->{adjust} !~ /[A-Za-z]/) {
+		if($opt->{hours}) {
+			$diff = (60 * 60) * ($opt->{adjust} || $opt->{hours});
+		}
+		elsif($opt->{adjust} !~ /[A-Za-z]/) {
+			$opt->{adjust} =~ s:(\d+)(\d[05])$:$1 + $2 / 60:e;
 			$opt->{adjust} =~ s/00$//;
 			$diff = (60 * 60) * $opt->{adjust};
 		}