Getting the system time?? May 18, 2010 12:11AM | Registered: 14 years ago Posts: 68 |
Re: Getting the system time?? May 18, 2010 12:15AM | Registered: 15 years ago Posts: 122 |
Re: Getting the system time?? May 18, 2010 05:55AM | Registered: 16 years ago Posts: 175 |
Re: Getting the system time?? May 18, 2010 10:45PM | Registered: 14 years ago Posts: 34 |
Re: Getting the system time?? May 18, 2010 10:59PM | Registered: 15 years ago Posts: 122 |
Re: Getting the system time?? May 18, 2010 11:02PM | Registered: 14 years ago Posts: 68 |
Re: Getting the system time?? May 19, 2010 12:35AM | Registered: 16 years ago Posts: 175 |
Re: Getting the system time?? May 19, 2010 11:32PM | Registered: 14 years ago Posts: 68 |
Re: Getting the system time?? May 20, 2010 11:26AM | Registered: 15 years ago Posts: 379 |
Your information is to limited to help you. Details about what you are doing and what the result is are required for assistance. Only thing we can say now is "if it's not working then you are doing something wrong" we cannot magically guess what you are doing wrong.Quote
newlife
ok, maby its just me but I cant seem to get it to work, keeps erroring, can someone tell me step by step how to do it. I've tried googleing but not found anything T_T
Re: Getting the system time?? May 20, 2010 02:40PM | Registered: 15 years ago Posts: 122 |
Re: Getting the system time?? May 20, 2010 06:46PM | Registered: 14 years ago Posts: 121 |
// Include standard library #include// Include library with time functions #include int main () { // Prepare a variable of type time_t called rawtime. // This is the native format for the time function. time_t rawtime; // Prepare a variable of type tm called timeinfo. // The time will be converted to this format which allows us to display it. struct tm * timeinfo; // Load the current time into the rawtime variable time ( &rawtime ); // Converts the time from time_t type variable to tm type variable so that we can convert the time to string. // This function may also convert from GMT to local time zone (please, anyone, feel free to correct me if I am wrong) timeinfo = localtime ( &rawtime ); // Converts the time to a string and prints it out printf ( "Current local time and date: %s", asctime (timeinfo) ); return 0; }
Re: Getting the system time?? May 22, 2010 02:43PM | Registered: 14 years ago Posts: 68 |
Re: Getting the system time?? May 23, 2010 10:26PM | Registered: 14 years ago Posts: 68 |
Re: Getting the system time?? May 24, 2010 12:32AM | Registered: 15 years ago Posts: 444 |
Re: Getting the system time?? May 24, 2010 10:44PM | Registered: 14 years ago Posts: 68 |
Re: Getting the system time?? May 25, 2010 12:26AM | Registered: 15 years ago Posts: 444 |
Kinda, the timeinfo variable is a tm struct, which looks like this:Quote
newlife
Thankyou
so could i use any interger i want as instead of time info? aslong as i declare it first? and then would it be useable just like a normal interger?
struct tm { int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; int tm_yday; int tm_isdst; };I you go timeinfo.tm_sec you would get the seconds in an integer. If you wanted to get minuets you would go timeinfo.tm_min, both of which you could use as an integer. It would help if you described exactly what you are trying to accomplish with this.
Re: Getting the system time?? May 25, 2010 03:33AM | Registered: 14 years ago Posts: 68 |
Re: Getting the system time?? May 25, 2010 03:51AM | Registered: 15 years ago Posts: 122 |
tm_sec -- seconds after the minute 0-61 (60 and 61 account for leep seconds not used by the wii) tm_min -- minutes after the hour 0-59 (exsplains itself but 15 would be quaterpast for example) tm_hour -- hours since midnight 0-23 (dito, 0 is obviously midnight) tm_mday -- day of the month 1-31 (if you cant figure this one out i'm not telling) tm_mon -- months since January 0-11 (pritty simple, 0 is jan 1 is frb ext) tm_year -- years since 1900 (this is not the same on all systems so i dont know if this is correct, but just check it and see what happens) tm_wday -- days since Sunday 0-6 (0 is sunday just like before) tm_yday -- days since January 1 0-365 (day of the year, just in case your intrested probably not of any practical use) tm_isdst -- Daylight Saving Time flag (never used it, so i cant realy help with this)hope this helps with you calinder and whatever else you are useing it for.