Re: Applescript 201 - speed
Re: Applescript 201 - speed
- Subject: Re: Applescript 201 - speed
- From: Tommy Bollman <email@hidden>
- Date: Mon, 24 May 2010 20:26:12 +0200
Hello.
first: there is an utility called millisec or something out there, which counts millsecs for applescript.
Wait a sec .. :-)
You have to find it yourself, as I have forgotten where I got it from. It takes like 5msec to execute
from a shell script.
timetools -- Tools for outputting time in various forms
Created by Andr Berg on 2008-09-12.
Copyright 2008 Berg Media. All rights reserved.
USAGE: timetools [-v] [-h] [-verbose] -<flag>|diff "<start-
time>" "<endtime>"
Measure/calculate time to varying precision,
based on different reference points.
-<flag> A flag is comprised of a category character and
a combination of one or more precision speci-
fiers.
currently, there are 9 categories available:
s... time, based on reference date 01/01/2001,
incl. decimal component
n... time, based on 01/01/2001, as fully scaled
integer
d... same as n, but outputs the decimal compo-
nent only
f... time, based on the reference date
01/01/1970
t... timestamp with format "hh:mm:ss" plus op-
tional .<precision> part
g... offset from GMT
y... time, since system startup
u... up time (basically same as y, but uses
diff. API)
l... timetools processing time, since program
launch
precision specifiers:
d = deci- (10th)
c = centi- (100th)
m = milli- (1000th)
u = micro- (1000000th)
n = nano- (1000000000th)
s = seconds (1)
tc = ticks (1/60th second)
following combinations are available:
s... sms, scms, sus
n... nds, ncs, nms, ndms, ncms, nus
d... dds, dcs, dms, ddms, dcms, dus, ds
f... fs, fms, fus
t... ts, tds, tcs, tms, tdms, tcms, tus
g... gs, gms
y... ytc, yus
u... ums, uus, uns
l... ls, lms, lus
-diff Calculate the difference between two colon-delim-
ited
24hr time strings (e.g. "20:00:05" and
"21:12:22")
The first parameter must represent a base time
and the second parameter must denote a future
time
OPTIONS:
-v, --version Display version and exit
-h, --help Display this help and exit
-verbose Verbose output
EXAMPLES:
timetools -ytc => 435241 (tick count s. system
startup)
timetools -uns => 1179046910610 (up time in
nanoseconds)
timetools -tms => 11:56:57.883
timetools -verbose -ls => verbose mode on
timetools processing time in
seconds:
0.004958
timetools -diff "20:00:05" "21:12:22" => 01:12:17
timetools -v => timetools version 0.2
RELEASE NOTES:
v0.2.1
(*) small bug fix for the -diff function.
(*) microseconds precision was still based on GMT time
in one rare occasion. fixed.
v0.2:
(*) times based on reference dates are now properly ad-
justed
for GMT offset as specified by the system.
(+) the t... category was added to print NSLog-like time-
stamps.
(+) the g... category was added to access the current off-
set
from GMT as set by the system.
v0.1:
( ) initial release
DISCLAIMER:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
BY USING THIS SOFTWARE IN ANY WAY, CONCEIVED OR OTHERWISE,
YOU AGREE TO BE BOUND BY THESE TERMS.
Best regards
Tommy Bollman
--------------------------------------------------------------------------------------------------
You will be advanced socially,
without any special effort on your part.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden