Forum Discussion
Aurel
Cirrus
Dec 02, 2013Irule syntax issue : missing a script
Hi,
I'm having the error message on line 18 "missing a script".
What i'm trying to do with this iRule is to append one or two "0" when the $fract value contains only two or one digit, whereas most of...
cjunior
Nacreous
Dec 02, 2013 I just test the syntax and it works.
Remember:
Trim the end of each line, indent the beginning for best pratices
and write the conditions with curly braces.
To paste the code on this forum, start each line with {tab} character
when HTTP_REQUEST {
set secs [clock seconds]
set msec [clock clicks -milliseconds]
set base [expr { $secs * 1000 } ]
set fract [expr { $msec - $base }]
log local0. "step_1 $fract"
if {$fract >= 1000 } {
set diff [expr { $fract / 1000 }]
incr secs $diff
incr fract [expr { -1000 * $diff }]
}
log local0. "step_2 $fract"
if {[$fract matches_regex "\d\d"]} {
append fract 0
}
elseif {$fract matches_regex {/\d} } {
append fract 00
}
log local0. "Timestamp with milliseconds is $secs.$fract"
}Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects