iRule Maintenance Windows
A fun, but not well known, feature on BIG-IP is the Statistics Profile. This tech tip is the second in a series on how the Statistics Profile and iRules, when working together, can save time, product...
Published Apr 10, 2007
Version 1.0Nov 14, 2008
Good catch on the octal bug. I obviously didn't test this iRule in the morning B-).
I've got another solution that avoids regular expressions and string manipulation. You can throw in a little fun and games with the polymorphic nature of TCL to turn the values 08 into a number by placing a decimal point after the lindex command. Kinda funky but it works. The only downside is that the time of H=08, M=09 will be 809.0.
After looking back at this, it's probably overkill to do any math at all since all I was doing with the expr's was to shift the number over to form a HHMM format. Seems pretty easy to do with just plain old string concatenation. Ultimlately I think this is the easiest solution
set cur_time "[lindex $l 1][lindex $l 2]"
Now there is no math involved at all, just a string allocation.
Anyone got a better idea?
BTW, here's the solution with dots and decimal removal
set cur_time [format {%g} [expr [expr [lindex $l 1].*100] + [lindex $l 2].]]
-Joe
-Joe