S
snoopy_
Hello,
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 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.