Re: Testing for daylight savings on a GMT server
joe_at_invalid.address
Date: 10/31/05
- Previous message: Paul Lalli: "Re: Testing for daylight savings on a GMT server"
- In reply to: snoopy__at_excite.com: "Testing for daylight savings on a GMT server"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 31 Oct 2005 11:37:34 -0600
snoopy_@excite.com writes:
> I have a server that is set to GMT and it needs to interact with
> other servers that are not and the other servers also observe
> daylight savings time adjustments. I am trying to re-write some
> scripts that do not require any changes due to the timechange, I
> thought I found the cure via perl's localtime function, but this
> last weekend showed me that since my box is set to GMT it doesn't
> care about DST and perl won't pick up the change.
>
> Here's what I was using (our code standard is ksh):
>
> chk_dst()
> {
> DST=`/usr/bin/perl -e '($isdst) = (localtime)[8]; print
> "$isdst\n";'`
> if [ $DST == 0 ]; then
> TIME1=14
> TIME2=19
> elif [ $DST == 1 ]; then
> TIME1=15
> TIME2=20
> elif [ $DST -ge -1 ]; then
> echo "Cannot determine system time" >> /tmp/dstTime.out
> fi
> }
>
> I was hopping to see a "0" when we are out of DST, and a "1" when
> we were in DST. Neither seems to be the case. I also tried setting
> my TZ variable to a local time, but I haven't seen any changes. It
> appears the issue is that since my box is set to GMT, I won't be
> able to use perl to get the DST info. Any suggestions?
>
> P.S. System OS is Solaris 2.8.
I'm not entirely sure I understand what you're asking, but if all you
want to do is find out if DST is in effect currently for some other
timezone, just prefix a TZ assignment to the perl script, eg
TZ=CST6DST /usr/bin/perl -e '($isdst) = (localtime)[8]; print "$isdst\n";'
Joe
-- Gort, klatu barada nikto
- Previous message: Paul Lalli: "Re: Testing for daylight savings on a GMT server"
- In reply to: snoopy__at_excite.com: "Testing for daylight savings on a GMT server"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|