[Date Index][Thread Index]
[Date Prev][Date Next][Thread Prev][Thread Next]
Re: How to define an \<expire\> tag\?
- From: Fritz Zaucker <nospam@thanx>
- Date: 26 Jan 1998 15:03:07 +0100
rse@engelschall.com (Ralf S. Engelschall) writes:
> | <define-tag expires>
> | <:{
> | # parse yy-mm-dd format into (dd, mm, yyyy)
> | my @et = reverse(split(/-/, '%0'));
> | # parse localtime into (dd, mm, yyyy)
> | my @ct = (localtime(time()))[3..5]; $ct[1] += 1; $ct[2] += 1900;
> |
> | # leave all standard locations
> | # (and implicitly enter "null" location)
> | # if already expired
> | if ( $ct[0]+31*$ct[1]*395*$ct[2]
> | >= $et[0]+31*$et[1]*395*$et[2]) {
> | print '<<main..'
> | }
> | }:>
> | </define-tag>
>
> Isn't it a little bit better? ;_)
Most clever! Thanks so much,
Fritz
> Perhaps someone of you makes it even better. At least the if-statement?
I guess the 395 should be replaced by 365??? Anyway, this breaks for
leap-years. How about using Timelocal instead? The problem is that
this is (funnily) not a standard perl module either. But as I have it,
I guess I'll use it.
Cheers,
Fritz
--
Dr. Fritz Zaucker, Head IT Support Group
Department of Electrical Engineering, Federal Institute of Technology
ETZ J97, Gloriastrasse 35, 8092 Zurich, Switzerland
Tel.: +41-1-632-5241 Fax: +41-1-632-1194 http://www.ee-staff.ethz.ch/~zaucker/
E-mail: zaucker@ee.ethz.ch (see home page for PGP key)
______________________________________________________________________
Website META Language (WML) www.engelschall.com/sw/wml/
Official Support Mailing List sw-wml@engelschall.com
Automated List Manager majordomo@engelschall.com