procmail
[Top] [All Lists]

Re: times -1

2004-07-01 05:17:43
On Wed, Jun 30, 2004 at 10:08:59PM -0500, David W. Tamkin wrote:
Ruud H.G. van Tol wrote:

An alternative (for times -123) is:

 *$ dot ?? $b^1 < -123

but that needs $dot.

Intriguing.

It never occurred to me to attempt to use a negative value for M; for w 
or x, yes, but not for M.  If that works, great.  It's not a big deal to 
define dot so long as you're writing the rcfile anyway.

Very cool stuff, Ruud.  I had started on a procmail-only 4-function
calculator a couple of months ago but put it aside as other projects
came up.

Regarding subtraction and your neat way of getting to absolute-value,
I will have to take a look when I have more "mips" working in my
brain.  One-and-a-half years ago I coded a date-check subroutine
for finding spam, since stuff beyond a certain threshold in the future
or the past is usually spam.  I had to grapple with "is it yesterday?"
and did it sort of by brute force, addint 24 hours to the time before
figuring in the TZ offset (which should max at -13/+12, or is it +13/-12,
I don't feel like going to look right this sec).  Here's the first part
of the INCLUDERC.  Note that "FROM_" is a private var that had been saved
earlier from the From_ (top) line.  And the "_" at the end of some of
the vars below is a mnemonic to me that the data is from the From_
line.

# Compare asserted date against date and time received, look for phoniness


 :0  # 030503 () find hour of delivery, assign to $HH_
  * FROM_  ??  ()\/[0-2][0-9]:
  * MATCH  ??  ^^\/..
  { HH_ = ${MATCH}00 }

 :0  # 030504 () sum TZ offset and arrival hour to find nominal day
  * $        $HH_^0
  * $  $TZ_OFFSET^0
  { } POST_HH_ = $=

     :0 E  # 030504 () we're at "yesterday": $POST_HH_ was negative
      *         2400^0
      * $  $POST_HH_^0 
      { YESTERDAY = $TRUE   POST_HH_ = $= }

     :0 E  # 030504 () else test for hour-wrap taking us to "tomorrow"
      * $  $POST_HH_^0
      *        -2400^0
      { TOMORROW  = $TRUE   POST_HH_ = $= }

Dallman

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>