Go Back   Hardware Forums > Software Support Forums > Web Development

Reply
 
LinkBack Thread Tools
Old 03-04-2005, 06:41 PM   #1 (permalink) Top
The King

 
Addis's Avatar
 
Join Date: Jan 2004
Age: 18 Male
Posts: 5,255
Times Helpful: 403
My Mood: Drunk
Status: Offline

My Computer

Default Need some tester people d00ds

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 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
File Type: zip systime.zip (92.2 KB, 24 views)
__________________
Never trust a program you don't have the source code for.

My website | Powerful Desktop Linux | Linux for human beings | Linux for power users | Linux for ricers
Send a message via MSN to Addis   Reply With Quote
Whats this? Ultra Flat Keyboard
Ultra Flat Keyboard
Seller Price (inc. VAT) Delivery Total Price Availability Seller Rating
Misco.co.uk £7.95 £4.69 £12.64 In Stock Rated: 4 out of 5 - Number of votes: 1354
Dell £18.98 Free £18.98 In Stock Rated: 0 out of 5 - Number of votes: 0
inkcartridgedirect.org.uk £5.78 £4.99 £10.77 In Stock Rated: 1 out of 5 - Number of votes: 1
Old 03-04-2005, 06:48 PM   #2 (permalink) Top
Alpha Geek
 
Waffle's Avatar
 
Join Date: Apr 2004
Age: 20 Male
Posts: 2,270
Times Helpful: 51
My Mood: Angelic
Status: Offline

My Computer

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.
Send a message via MSN to Waffle   Reply With Quote
Old 03-04-2005, 07:28 PM   #3 (permalink) Top
The King

 
Addis's Avatar
 
Join Date: Jan 2004
Age: 18 Male
Posts: 5,255
Times Helpful: 403
My Mood: Drunk
Status: Offline

My Computer

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.
__________________
Never trust a program you don't have the source code for.

My website | Powerful Desktop Linux | Linux for human beings | Linux for power users | Linux for ricers
Send a message via MSN to Addis   Reply With Quote
Old 03-04-2005, 10:22 PM   #4 (permalink) Top
Administrator
 
Sniper's Avatar
 
Join Date: Oct 2001
Age: 24 Male
Posts: 4,420
Times Helpful: 116
My Mood: Bored
Status: Offline

My Computer

Is it not possible just to add one hour to the time? time + 1 hour? I get the same btw.
  Reply With Quote
Old 04-04-2005, 04:48 PM   #5 (permalink) Top
The King

 
Addis's Avatar
 
Join Date: Jan 2004
Age: 18 Male
Posts: 5,255
Times Helpful: 403
My Mood: Drunk
Status: Offline

My Computer

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.
__________________
Never trust a program you don't have the source code for.

My website | Powerful Desktop Linux | Linux for human beings | Linux for power users | Linux for ricers
Send a message via MSN to Addis   Reply With Quote
Old 04-04-2005, 04:56 PM   #6 (permalink) Top
The King

 
Addis's Avatar
 
Join Date: Jan 2004
Age: 18 Male
Posts: 5,255
Times Helpful: 403
My Mood: Drunk
Status: Offline

My Computer

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.
__________________
Never trust a program you don't have the source code for.

My website | Powerful Desktop Linux | Linux for human beings | Linux for power users | Linux for ricers
Send a message via MSN to Addis   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Just a tidbit for you people in the UK Fred PC Gaming 6 19-03-2005 07:25 PM
101 Ways to annoy people Nic General Chat 2 19-03-2005 06:20 PM
Whasssa matta people? Can'tca read? Egaladeist General Chat 2 20-11-2004 11:23 PM


All times are GMT +1. The time now is 05:47 PM.


Copyright © 2000 - 2008 · HARDWAREFORUMS.COM · All rights reserved