duration2sec()

Francis J. Lacoste flacoste at logreport.org
Tue Nov 12 21:34:46 CET 2002


On lun, 2002-11-11 at 01:31, Edwin Groothuis wrote:
> 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.

Indeed, that was the original intent. So you found yet another bug!

> 
> --- 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.

Why? That's a sane thing to do: the user_session-visit-times www report
uses a duration 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).

I don't understand that requirements. Are you suggesting that we should
use separate types? Can you give an example? 


Francis J. Lacoste

-- 
Francis J. Lacoste              . .           http://www.logreport.org
/^LogReport$/               . .               flacoste at logreport.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.logreport.org/pipermail/development/attachments/20021112/05d1d4f8/attachment.bin 


More information about the Development mailing list