Author |
Message |
Maverick

Age:40 Gender: Joined: Feb 26 2005 Posts: 1521 Location: The Netherlands Offline
|
Posted: Sun Feb 27, 2005 1:48 pm Post subject: Comparing dates? |
 |
|
|
|
Ok I got a small challenge for all interested people
I am making a bot that stores date&time in a file. I can get this from the file and into a String.
Now I need to compare this date&time and compare it to the current date&time. I need to get the difference between the two and get the number of days that have passed.
I am trying to do it myself, searched everywhere but couldn't find a good example or explenation anywhere so I'm asking the experts here for help.
It seems like that CTime isn't supported so I have to do it with time_t . (Since Mervbot doesn't use MFC)
Can someone help me by posting some example code or send me in the correct direction?
Thanks  _________________
|
|
Back to top |
|
 |
50% Packetloss Server Help Squatter

Age:40 Gender: Joined: Sep 09 2003 Posts: 561 Location: Santa Clarita, California Offline
|
|
Back to top |
|
 |
Maverick

Age:40 Gender: Joined: Feb 26 2005 Posts: 1521 Location: The Netherlands Offline
|
Posted: Sun Feb 27, 2005 2:34 pm Post subject: |
 |
|
|
|
50% Packetloss wrote: | http://www.cplusplus.com/ref/ctime/ | Yes I looked there already but only problem is that I need to store the time.
I do this via a string. However there is no method available for converting a string into a time_t value. |
|
Back to top |
|
 |
Solo Ace Yeah, I'm in touch with reality...we correspond from time to time.

Age:37 Gender: Joined: Feb 06 2004 Posts: 2583 Location: The Netherlands Offline
|
Posted: Sun Feb 27, 2005 2:34 pm Post subject: |
 |
|
|
|
Store it as binary? |
|
Back to top |
|
 |
Maverick

Age:40 Gender: Joined: Feb 26 2005 Posts: 1521 Location: The Netherlands Offline
|
Posted: Sun Feb 27, 2005 2:39 pm Post subject: |
 |
|
|
|
Solo Ace wrote: | Store it as binary? | in a .ini? You show me how  |
|
Back to top |
|
 |
Mine GO BOOM Hunch Hunch What What

Age:41 Gender: Joined: Aug 01 2002 Posts: 3615 Location: Las Vegas Offline
|
Posted: Sun Feb 27, 2005 3:10 pm Post subject: |
 |
|
|
|
Maverick wrote: | in a .ini? You show me how :P |
fprintf(FILE, "%d\n", ctime_value);
Its only an integer. |
|
Back to top |
|
 |
Maverick

Age:40 Gender: Joined: Feb 26 2005 Posts: 1521 Location: The Netherlands Offline
|
Posted: Sun Feb 27, 2005 3:44 pm Post subject: |
 |
|
|
|
but how can you get that back into time_t value? |
|
Back to top |
|
 |
D1st0rt Miss Directed Wannabe

Age:37 Gender: Joined: Aug 31 2003 Posts: 2247 Location: Blacksburg, VA Offline
|
|
Back to top |
|
 |
Cyan~Fire I'll count you!

Age:37 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Sun Feb 27, 2005 10:39 pm Post subject: |
 |
|
|
|
No, just use MGB's way of doing it. That will automatically store it as a time_t. _________________ This help is informational only. No representation is made or warranty given as to its content. User assumes all risk of use. Cyan~Fire assumes no responsibility for any loss or delay resulting from such use.
Wise men STILL seek Him. |
|
Back to top |
|
 |
Maverick

Age:40 Gender: Joined: Feb 26 2005 Posts: 1521 Location: The Netherlands Offline
|
Posted: Mon Feb 28, 2005 5:12 am Post subject: |
 |
|
|
|
OK I will try that.
Thanks for your help, guys  |
|
Back to top |
|
 |
Maverick

Age:40 Gender: Joined: Feb 26 2005 Posts: 1521 Location: The Netherlands Offline
|
Posted: Mon Feb 28, 2005 4:34 pm Post subject: |
 |
|
|
|
OMG you guys are awesome.. IT WORKS!
Woo many thanks  |
|
Back to top |
|
 |
Solo Ace Yeah, I'm in touch with reality...we correspond from time to time.

Age:37 Gender: Joined: Feb 06 2004 Posts: 2583 Location: The Netherlands Offline
|
Posted: Mon Feb 28, 2005 5:08 pm Post subject: |
 |
|
|
|
Meh, whut evar! |
|
Back to top |
|
 |
|