tags:

views:

14

answers:

1

Why RWTime is giving 1 hour more

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

main(){
 RWTime t;   // Current time
 RWTime d(RWTime::beginDST(1990, RWZone::local()));
   cout << "Current time:         " << RWDate(t) << " " << t <<
            endl;
   cout << "Start of DST, 1990:   " << RWDate(d) << " " << d <<
           endl;
}

Above program prints:

root@otp42mas:/home/nmsadm/sapna/cProgS# ./a.out
Current time: 10/27/10 10/27/10 17:08:06
Start of DST, 1990: 04/01/90 04/01/90 03:00:00

But date gives:

root@otp42mas:/home/nmsadm/sapna/cProgS# date
Wed Oct 27 16:08:10 IST 2010

+1  A: 

My sixth sense is tingling, it tells me that the answer has something to do with the daylight savings time ... I'm not sure why, though ...

I think that's a pretty good guess - if IST is Indian Standard Time, then there's apparently no daylight savings time, and it looks like the Rogue Wave library is applying a daylight savings adjustment.
Doug