Hello,
How can I show in an .aml script the "elapsed time" (time since .aml execution or running time)?
Thx.
Hello,
How can I show in an .aml script the "elapsed time" (time since .aml execution or running time)?
Thx.

There is a system time function. Here is a processing time routine from an simulation AML I wrote several years ago. There is likely a much more efficient way to code this but it works. You can call the routine "time" using the &call directive.
If you just want to print start and stop time to the screen you can use &type [date -time] at the beginning and end of the AML.
/**** ELAPSED TIME ROUTINE
/* SET START TIME AT INITIATION OF AML
&s starttime = [date -time]
/************************************************************************************
&routine time
/************************************************************************************
&s endtime = [date -time]
&s sthr = [before %starttime% .]
&s stmin = [after %starttime% .]
&s stsec = [after %stmin% .]
&s stmin = [before %stmin% .]
&s endhr = [before %endtime% .]
&s endmin = [after %endtime% .]
&s endsec = [after %endmin% .]
&s endmin = [before %endmin% .]
&s endtime = [calc %endhr% + ( %endmin% / 60 ) + ( %endsec% / 3600 ) ]
&s starttime = [calc %sthr% + ( %stmin% / 60 ) + ( %stsec% / 3600 ) ]
&s eltime = [calc %endtime% - %starttime% ]
&if %eltime% < 0 &then &s eltime = [calc %eltime% + 24 ]
&s elhr = [trunc %eltime%]
&if %elhr% < 10 &then &s elhr = 0%elhr%
&s eltime = [calc ( %eltime% - %elhr% ) * 60 ]
&s elmin = [trunc %eltime%]
&if %elmin% < 10 &then &s elmin = 0%elmin%
&s elsec = [round [calc ( %eltime% - %elmin% ) * 60 ] ]
&if %elsec% < 10 &then &s elsec = 0%elsec%
&s ElapsedTime = %elhr%:%elmin%:%elsec%
&return
/************************************************************************************
Last edited by jevans02; 04-27-2012 at 10:14 AM.
Jeffrey S. Evans
Senior Landscape Ecologist
The Nature Conservancy
Central Science/DbyD
Assistant Adjunct Professor
Zoology & Physiology
University of Wyoming

I miss the good old days of AML! That's a pretty cool routine!
Joe Borgione
AlpineGeographic
If the suggestion I provide helps solve your problem, please feel free to give it a favorable review by clicking the up arrow. That's only only reward I get for sharing 20 + years of professional GIS experience.
Bookmarks