Need some tester people d00ds

Discussion in 'Web Design & Programming' started by Addis, Apr 3, 2005.

  1. Addis

    Addis The King

    Likes Received:
    91
    Trophy Points:
    48
    for a certain programming job I have in mind, I need to log some data and write it to a file. I've got that part but I needed to find a way to get the system time. After ages of searchin I managed to find a method that i could understand :rolleyes: and used it.

    Heres the problem: The date of part of the code seems to work ok, with it working. But when the time is displayed, the hour value is one lower than my system time. eg. at 18:00 the time is 17:00

    I remembered about daylight saving times but I would have thought that it would read directly from my time (which is correct). I just want to know whether you get the same result or whether its just some freak anomaly with my PC.

    Heres an example exe which just displays time

    (sorry about the file size still not sorted that out)
     

    Attached Files:

  2. Waffle

    Waffle Alpha Geek

    Likes Received:
    38
    Trophy Points:
    0
    I get 18:47 as well, so one hour behind.

    What are you using to do this sort of thing? I'm taking a course @ College next year, but would like a headstart lol.
     
  3. Addis

    Addis The King

    Likes Received:
    91
    Trophy Points:
    48
    Its in C++ and I'm using Dev-C++ latest version (www.bloodshed.net).

    I guessed that would be it, but I'm having some headache's on how to predict daylight saving time, and leap years make things harder again. Bugger this I'm going for a shower and some food.
     
  4. Sniper

    Sniper Administrator Staff Member

    Likes Received:
    59
    Trophy Points:
    63
    Is it not possible just to add one hour to the time? time + 1 hour? I get the same btw.
     
  5. Addis

    Addis The King

    Likes Received:
    91
    Trophy Points:
    48
    Yea it is, but the problem comes when daylight saving times aren't like that anymore. The clocks go forward on a different date each year, and I don't know how to write an algorithm to predict the date.

    Maybe something like:

    if (date.wMonth == 4 && date.wDay >= /*date of clocks go forward*/)
    {
    if (date.wMonth == 10 && date.wDay >= /*date of clocks go back*/)
    /*hour variable*/ = date.wHour + 1;
    }

    But I don't know the dates which they change since the dates change each year.
     
  6. Addis

    Addis The King

    Likes Received:
    91
    Trophy Points:
    48
    Its ok now I fixed it. Just ended up using a totally different function, reads the time ok now. The function gets the same job done and puts it into a character array, making it much easier for me to manipulate and it tells the time correctly while only using a small fraction of code than the other inaccurate complicated one. :)
     

Share This Page