Re: Testing for daylight savings on a GMT server
From: Bart Lateur (bart.lateur_at_pandora.be)
Date: 11/05/05
- Next message: Casper H.S. ***: "Re: When was the SPARC 20 introduced and discontinued?"
- Previous message: llothar: "Re: Ultra 5 Newbie Keyboard question"
- Maybe in reply to: Mothra: "Re: Testing for daylight savings on a GMT server"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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.
- Next message: Casper H.S. ***: "Re: When was the SPARC 20 introduced and discontinued?"
- Previous message: llothar: "Re: Ultra 5 Newbie Keyboard question"
- Maybe in reply to: Mothra: "Re: Testing for daylight savings on a GMT server"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]