1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
if (word(2 $loadinfo()) != [pf]) { load -pf $word(1 $loadinfo()); return; };
#
# Here's the plan
# Kanan wants a way to manipulate $utime() values. Because theyre
# thrown about as two words, we cant actually have the math parser
# handle them automatically (alas), and writing built in functions
# just to do this seems like overkill. So i wrote these aliases for
# his (and your) convenience. Use this is as a starting point for you
# own alias needs, or drop me a line if you have more suggestions.
# (jnelson@acronet.net)
#
#
# Add two utimes.
#
alias utime_add
{
local sec,usec;
@ sec = [$0] + [$2];
@ usec = [$1] + [$3];
if (usec > 1000000)
{
@ usec -= 1000000, sec++;
};
@ function_return = sec ## [ ] ## right(6 000000$usec);
};
#
# Subtract two utimes. The LARGER utime (the more recent) should
# be the first one specified
#
alias utime_sub
{
local sec,usec;
@ sec = [$0] - [$2];
@ usec = [$1] - [$3];
if (usec < 0)
{
@ usec += 1000000, sec--;
};
@ function_return = sec ## [ ] ## right(6 000000$usec);
};
#
# You pass a utime as $0, $1, and this function will return
# how many useconds have passed since then.
#
alias time_since
{
local now $utime();
@ function_return = utime_sub($now $0 $1);
};
#hop'97
|