Results 1 to 4 of 4

Thread: RW Time for DST ISSUE

  1. #1
    Junior Member
    Join Date
    Jun 2009
    Posts
    5

    RW Time for DST ISSUE

    We are having an issue with the RW Time object translating times into DST. We are setting an object to the current server time, but it is changing the time by one hour. How do we prevent this from happening? The server already with handle the DST and we don't want RW time to adjust for this.

    Simple sample with output.

    Update: We tried using RWTime t(timeinfo, RWZone:s()); command, but this did not work.

    ---------------------------------------------------------
    #include <iostream>
    #include <rw/cstring.h>
    #include <rw/rwdate.h>
    #include <rw/rwtime.h>

    using namespace std;

    int main()
    {
    time_t rawtime;
    struct tm * timeinfo;

    time ( &rawtime );
    timeinfo = localtime ( &rawtime );
    printf ( "Current local time and date: %s", asctime (timeinfo) );
    RWZone::local(new RWZoneSimple(RWZone::USEastern,RWZone::NoDST));
    RWTime t(timeinfo, RWZone::local());
    cout << " RW Time : " << t << endl;

    return 1;
    }


    > ./RWT1.exe
    Current local time and date: Thu Oct 29 10:08:47 2009
    RW Time : 10/29/09 09:08:47

  2. #2
    Administrator
    Join Date
    Feb 2008
    Posts
    23

    Re: RW Time for DST ISSUE

    Gary,

    I would change your RWZone::local to use the Operating System DST rules.To install the underlying system's DST rule as your global local time, use:

    RWZone::local( &RWZone::os() );

    This should solve the problem you are seeing.

    Jeremy
    Jeremy Dean
    Rogue Wave Software
    Technical Support
    support@roguewave.com

  3. #3
    Junior Member
    Join Date
    Jun 2009
    Posts
    5

    Re: RW Time for DST ISSUE

    Thanks for the quick response. We tried that, and it didn't work.

    #include <iostream>
    #include <rw cstring.h="">
    #include <rw rwdate.h="">
    #include <rw rwtime.h="">

    using namespace std;

    int main()
    {
    time_t rawtime;
    struct tm * timeinfo;

    time ( &rawtime );
    timeinfo = localtime ( &rawtime );
    printf ( "Current local time and date: %s", asctime (timeinfo) );

    //RWZone::local(new RWZoneSimple(RWZone::USEastern,RWZone::NoDST));

    //RWTime t(timeinfo, RWZone::local( &RWZone::os()));
    RWTime t(timeinfo, RWZone::os());
    cout << " RW Time : " << t << endl;

    return 1;
    }

    > ./RWT1.exe
    Current local time and date: Thu Oct 29 11:43:19 2009
    RW Time : 10/29/09 10:43:19

    UNIX version : UNIX IBM AIX 6.1
    Source Por version : SourcePro C++ Edition 9</rw></rw></rw></iostream>

  4. #4
    Junior Member
    Join Date
    Jun 2009
    Posts
    5

    Re: RW Time for DST ISSUE

    Thanks for the quick response. We tried that change, but it did not help.
    Here's the code with the changes, but the same results.

    #include <iostream>
    #include <rw cstring.h="">
    #include <rw rwdate.h="">
    #include <rw rwtime.h="">

    using namespace std;

    int main()
    {
    time_t rawtime;
    struct tm * timeinfo;

    time ( &rawtime );
    timeinfo = localtime ( &rawtime );
    printf ( "Current local time and date: %s", asctime (timeinfo) );

    //RWZone::local(new RWZoneSimple(RWZone::USEastern,RWZone::NoDST));

    //RWTime t(timeinfo, RWZone::local( &RWZone::os()));
    RWTime t(timeinfo, RWZone::os());
    cout << " RW Time : " << t << endl;

    return 1;
    }

    > ./RWT1.exe
    Current local time and date: Thu Oct 29 16:14:49 2009
    RW Time : 10/29/09 15:14:49</rw></rw></rw></iostream>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •