Re: Testing for daylight savings on a GMT server

From: Bart Lateur (bart.lateur_at_pandora.be)
Date: 11/05/05


Date: Sat, 05 Nov 2005 09:55:14 GMT

snoopy_@excite.com wrote:

> DST=`/usr/bin/perl -e '($isdst) = (localtime)[8]; print "$isdst\n";'`

> I was hopping to see a "0" when we are out of DST, and a "1" when we
>were in DST.

Maybe you're being bitten by the standardd boolean false in perl, which
stringifies to "".

And using the -l command line switch (lower case L) will make print add
the newline for you. So this can become:

        DST=`/usr/bin/perl -le 'print +(localtime)[8] || 0'`

The "+" is one way to make sure perl doesn't treat just the (localtime)
as the parameters to print.

-- 
	Bart.