duration2sec()

Edwin Groothuis edwin at mavetju.org
Mon Nov 11 07:31:41 CET 2002


Right now, duration2sec returns 0 if the supplied value doesn't
contain a multiplier (yMwdhms), causing update_aggregator_data()
to run wildly in its loop if the range-size is set to "3600" (without
the s). I do think that seconds should be the basic unit for time
and that specifyng them shouldn't be necessary.

--- DataTypes.pm.orig	Mon Nov 11 16:45:01 2002
+++ DataTypes.pm	Mon Nov 11 16:46:57 2002
@@ -210,7 +210,7 @@
 	      (?:(\d+)d(?:ays?)?      )?\s*	# Days
 	      (?:(\d+)h(?:ours?)?     )?\s*	# Hours
 	      (?:(\d+)m(?:inu?t?e?s?)?)?\s*	# Minutes
-	      (?:(\d+)s(?:eco?n?d?s?)?)?\s*	# Seconds
+	      (?:(\d+)s?(?:eco?n?d?s?)?)?\s*	# Seconds
	      $/x;
     my ( $years, $months,  $weeks,  $days,   $hours,  $mins, $secs ) =
        ( $1 || 0, $2 || 0, $3 || 0, $4 || 0, $5 || 0, $6 || 0, $7 || 0 );

Probably a broken patch since I have no idea how that regular
expression works. Please don't ask me why I put a duration-type in
a rangegroup.

Also, I would suggest to keep a simple rule for differentiating
between day-based unit (YMWD for year month week day) and second-based
units (hms for hour minute seconds).

Edwin, fighting with Lire and *not* happy.

-- 
Edwin Groothuis      |            Personal website: http://www.MavEtJu.org
edwin at mavetju.org    |    Weblog: http://www.mavetju.org/weblog/weblog.php 
bash$ :(){ :|:&};:   | Interested in MUDs? http://www.FatalDimensions.org/

-- 
To UNSUBSCRIBE, email to development-request at logreport.org with a subject of
"unsubscribe". Trouble? Send an email with subject "help" to
development-request at logreport.org



More information about the Development mailing list