Wayne- thank you very much for finding me that time.h tutorial; it was VERY effective. anyways, in time.h there is a struct called struct tm. in this struct, there is an int tm_yday which gives the number of days since Jan 1. now lets say you had int month=7, int day=1, and int tm_yday=300. You are comparing July 1st to whatever 300 days is (somewhere in October). How can you make int month and day into a type tm_yday? I need to make 7, 1 into a type tm_yday in order to compare the two. thanks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
switch(month)
{
case 12:
returnval += 30;
case 11:
returnval += 31;
case 10:
returnval += 30;
case 9:
returnval += 31;
case 8:
returnval += 31;
case 7:
returnval += 30;
case 6:
returnval += 31;
case 5:
returnval += 30;
case 4:
returnval += 31;
case 3:
returnval += 28;
case 2:
returnval += 31; //Assumming non-leap year
case 1:
return returnval;
}
} //End of Function
I have checked this function fully. It should not contain any errors. If it does, opps. It is early in the morning. Anyhow, hopefully this is what you are looking for. Happy coding.
Curtis
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Please note that the tutorial I pointed you to was just one of many hits I got by going to google and searching on
time.h functions
For questions that are more language oriented, I recommend doing a google search before you ask a forum. Most of the time, the answer can be found that way, and it saves Curtis' and my time for the "the window won't stay open, help!" questions. ;-)
Remember, google is our friend.
Wayne
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yeah, if they like to assume that the time that it takes for them to do the search is more important than the time for me (or someone else) to answer the question.
Or, give a man a fish, he eats for a day, teach him to fish....
I don't know what point you were trying to make, but it came across as its OK for them to be too lazy to try and find the answer for themselves.
Wayne
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Wayne- thank you very much for finding me that time.h tutorial; it was VERY effective. anyways, in time.h there is a struct called struct tm. in this struct, there is an int tm_yday which gives the number of days since Jan 1. now lets say you had int month=7, int day=1, and int tm_yday=300. You are comparing July 1st to whatever 300 days is (somewhere in October). How can you make int month and day into a type tm_yday? I need to make 7, 1 into a type tm_yday in order to compare the two. thanks.
"PLEASE PLEASE STOP CREATING NEW THREADS!!!!!!!!!!!!!!!!
Use the "Post A Message To This Thread" on this thread. Just like me. If you find yourself putting a number behind your subject, you are doing it wrong." (Wayne, http://sourceforge.net/forum/message.php?msg_id=1746540\)
In short, keep the same information in the same thread.
You need to make a function that can use the month and day to find how many days since Jan 1
Curtis
//Function mentioned in first post
int DayFinder(int day, int month) //Returns the amount of days from Jan 1
{
int returnval = day;
if(day > 31 || day < 1 || month > 12 || month < 1) //Check inputs for vaild
return -1;
switch(month)
{
case 12:
returnval += 30;
case 11:
returnval += 31;
case 10:
returnval += 30;
case 9:
returnval += 31;
case 8:
returnval += 31;
case 7:
returnval += 30;
case 6:
returnval += 31;
case 5:
returnval += 30;
case 4:
returnval += 31;
case 3:
returnval += 28;
case 2:
returnval += 31; //Assumming non-leap year
case 1:
return returnval;
}
} //End of Function
I have checked this function fully. It should not contain any errors. If it does, opps. It is early in the morning. Anyhow, hopefully this is what you are looking for. Happy coding.
Curtis
Information about functions in c standard libraries: http://www.gnu.org manuals online / glibc, glibc means gnu c libraries for gcc.
tkorrovi
Please note that the tutorial I pointed you to was just one of many hits I got by going to google and searching on
time.h functions
For questions that are more language oriented, I recommend doing a google search before you ask a forum. Most of the time, the answer can be found that way, and it saves Curtis' and my time for the "the window won't stay open, help!" questions. ;-)
Remember, google is our friend.
Wayne
> time.h functions
And if you also add gcc then you probably find glibc page.
tkorrovi
tkorrovi,
I was trying to show how easy it is, that even a putz like me can find the info with a simple search.
;-)
Wayne
Yes but for them writing question here is easier.
tkorrovi
Yeah, if they like to assume that the time that it takes for them to do the search is more important than the time for me (or someone else) to answer the question.
Or, give a man a fish, he eats for a day, teach him to fish....
I don't know what point you were trying to make, but it came across as its OK for them to be too lazy to try and find the answer for themselves.
Wayne