Results 1 to 5 of 5

Thread: System time infor mations

  1. #1

    Thread Starter
    PowerPoster eranga262154's Avatar
    Join Date
    Jun 2006
    Posts
    2,201

    Wink System time infor mations

    Hi all,

    I'm going to learn a new subject on C++. Working with Windows API. Since I work with Java there is no API used, but I feel it is better to work a little with APIs.

    Here is my attempt for that.

    I want to read the system time zones and display on the console. Basically in two columns, City and the Time offset. From where I should start work. Can you guys give some clues. Following week I'm free because of Christmas, so I can do some work on it.

    Thanks
    “victory breeds hatred, the defeated live in pain; happily the peaceful live giving up victory and defeat” - Gautama Buddha

  2. #2
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246

    Re: System time infor mations

    Ah, I just realised, you're from Sri Lanka. My team leader at work is from Sri Lanka.. he had some Christmas festival thing yesterday.

    Anyway.

    Your problem doesn't require any APIs. Timezones don't just "change".. they are how they are. Look them up and store them..

    EG, my Timezone is GMT +10. You add to that, if such areas use Daylight savings.. which, my area does.

    They aren't stored on the system.. because they aren't something that needs to be stored.

    chem

    Visual Studio 6, Visual Studio.NET 2005, MASM

  3. #3

    Thread Starter
    PowerPoster eranga262154's Avatar
    Join Date
    Jun 2006
    Posts
    2,201

    Re: System time infor mations

    On your first question, yep I'm from Sri Lanka and currently working in Colombo, capital of my country.

    Regarding my question, you are right. Tims zones doesn't change. But, what I'm try to do is, read all the timezones and print them on a console that's it. Just to learn something. Want to print timezone and the city/country of each where in windows system included.

    Something like this,

    Timezone City
    GTM + 10 Victoria
    GTM + 6 Sri Jayawardanapura
    etc...
    etc...

    Just like that all the timezones. If I can use APIs it is so nice. Because I don't use much and no clear idea about it. You know in java, there is no APIs. Whatever I need, have to code and test.
    “victory breeds hatred, the defeated live in pain; happily the peaceful live giving up victory and defeat” - Gautama Buddha

  4. #4
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246

    Re: System time infor mations

    You can get your computers current timezone setting.. but you can't get a list of timezones.. because they don't need to be stored on the computer anywhere.
    Code:
    TIME_ZONE_INFORMATION tzi;
    GetTimeZoneInformation(tzi);
    cout << "GMT -" << tzi.Bias << " minutes";
    chem

    Visual Studio 6, Visual Studio.NET 2005, MASM

  5. #5

    Thread Starter
    PowerPoster eranga262154's Avatar
    Join Date
    Jun 2006
    Posts
    2,201

    Re: System time infor mations

    Yes, I found on MSDN that I can get that list. Only the systems' details. Thanks for the infor. I'll got the point. So now I deal with the system time zone informations.
    “victory breeds hatred, the defeated live in pain; happily the peaceful live giving up victory and defeat” - Gautama Buddha

Posting Permissions

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



Click Here to Expand Forum to Full Width