Hi All,

I am using RWZoneSimple object and RWTime object to check whether a given Date is falling under DST (Daylight Saving Time) or not when my server (HP-UX system) is in Non DST time (by having TZ=US/Arizona).

I have created RWZoneSimple with the date that falls in DST ("05302008"// May 30) I have updated my TZ variable to MST7MDT and executed the objRWTime.isDST() method. This was returning 1.

But after that, I have created another objRWTime with the date that falls in NON DST ("05302008"// May 30). I have updated my TZ variable to MST7 (because now I want to be in Non DST) and also I have updated my system's time to Nov, 10, 2008. Then I executed the objRWTime.isDST() method. But now the function is returning 0. I am getting this 0 even if I not updating my system's time to Nov, 10, 2008 and be in current date (May 26th).

I want to use only default US Timezone rules irrespective of the TZ variable. I am using HP-UX system.

My test program is as follows:
------------------------------

#include <rw/zone.h>
#include <rw/rwtime.h>
#include <rw/rwdate.h>
#include <rw/rstream.h>

int main(){

  RWZoneSimple myZone = RWZoneSimple(RWZone::USMountain);

  //RWCString myDateStr("02152008"); // NO DAYLIGHT
  RWCString myDateStr("05302008"); // May 30 - DAYLIGHT

  RWCString myTimeStr("05:00:00AM");

  RWDate myDate(myDateStr);

  RWTime *myTime = new RWTime(myDate, myTimeStr, myZone);

  RWCString myDateAndTime = (*myTime).asString("%Y""%m""%d""%H""%M""%S.GMT", RWZone::utc());

  cout << "myDateAndTime = " << myDateStr << myTimeStr << endl;
  cout << "myDateAndTime in UTC = " << myDateAndTime << endl;

  cout<<"myTime.isDST ------------>>>>>>>>>> " << (*myTime).isDST() << endl;

  return 0;
}

I compile this program using "compile test.C" which has the following content:
echo "MAKEING........${1}....."
executable=`echo ${1} | cut -d'.' -f1`
/opt/aCC/bin/aCC -D_REENTRANT -DD_PTHREAD -DRWSTD_MULTI_THREAD -DHPUX_11 +eh +DA2.0 +inst_implicit_include -Wl,+n -
Wl,+s -o $executable $1 -lpthread -lm -lrwtool

In the above test program I have created a RWZone object by "RWZoneSimple myZone = RWZoneSimple(RWZone::USMountain);"

I have the DateString as "05302008" (May 30) which falls in Daylight.

Output when I set the TZ=MST7MDT:
-------------------------------------
shakila - op13 - /home/shakila/work> echo $TZ
MST7MDT
shakila - op13 - /home/shakila/work> ./trw
myDateAndTime = 0530200805:00:00AM
myDateAndTime in UTC = 20080530110000.GMT
myTime.isDST ------------>>>>>>>>>> 1

Output when I set the TZ=MST7 or TZ=US/Arizona:
--------------------------------------------------
shakila - op13 - /home/shakila/work> echo $TZ
US/Arizona
shakila - op13 - /home/shakila/work> ./test
myDateAndTime = 0530200805:00:00AM
myDateAndTime in UTC = 20080530110000.GMT
myTime.isDST ------------>>>>>>>>>> 0

I want to use only default US Timezone rules irrespective of the TZ variable. But please observe that when my TZ=MST7 or TZ=US/Arizona the output of (*myTime).isDST() is = 0.

Please Note: I am in India and my default TZ will be set to IST-5:30. So for testing these program I used set TZ to MST7MDT (to simulate that I am Daylight) or just MST7 (to simulate that I am NON-Daylight).

Kindly help me to resolve this issue. Thanks in advance.

Thanks,
Shakila.

and we're supposed to be able to debug your proprietary, enterprise-class library functions .... how?

what's wrong with <time.h> that you need some non-portable obscure library to calculate UTC?


.

Hi,

With the help of RWZoneSimple and RWTime object, I want check whether the given date is falling in DST or not irrespective of the TZ variable.

If my TZ is set to MST7MDT, the isDST() returns 1 but if TZ is set to US/Arizona then isDST() returns 0.

Kindly help me in resolving this issue.

Thanks,
Shakila.

AHA

Because the Glorious State of Arizona ... does not use Daylight Savings Time.

It's like the only state in the US that doesnt. Why, I don't know. My guess is it's Phoenix's fault. A truly miserable city, the culture is terrible, and the people were tiresome.

so your Rogue Wave libraries are working correctly.

EDIT: some parts of Arizona do use DST. Some of the Native American reservations in the NE part of the state, are not under state jurisdiction, and choose to follow DST like the rest of the country. I wonder how your RW libraries handle that

.

This article has been dead for over six months. Start a new discussion instead.