Ecere SDK/eC Forums http://www.ecere.com/community/ Print view |
|
Problem with time.month http://www.ecere.com/community/viewtopic.php?f=2&t=136 |
Page 1 of 1 |
Author: | richard567 [ Tue Mar 01, 2011 6:36 pm ] |
Post subject: | Problem with time.month |
Hi All, I am having a problem with time.month returning a value of 1 rather than the current system clock month. All other time values are returning correctly including time.year; time.day; time.hour; time.minute; and time.second. I have a feeling it is returning an error value of 1 rather than the current system clock month. At one point during compiling, I thought I received a message regarding compatibility or something with Ecere but I am not sure. I don't seem to be able to re-create the error message. Any idea what is causing this? Here is the section of code: Code: Select all
My personal project mentioned in the following post/link is substantially up and running: http://www.ecere.com/forums/viewtopic.php?f=2&t=135 Thanks for all previous help from Jerome. Once I was able to get a calculated value to display, it made things much easier because then I could tell immediately if I was doing something wrong. It would probably be an easy project for a seasoned programmer but it was a challenge for this amateur. I have just minor work left including the time.month problem mentioned above but it is up and fully functioning. Thanks again for all previous help and thanks in advance if somebody can help me with the problem mentioned above. Richard |
Author: | richard567 [ Tue Mar 01, 2011 9:01 pm ] |
Post subject: | Re: Problem with time.month |
Okay. I'm starting to feel like an idiot. Can somebody just verify that I am correct on the following: time.month returns a cardinal number 0-11 as months since January. To use a value from system time corresponding to March, I need to use (time.month + 1) and same for all the other months? Thanks in advance. Richard |
Author: | jerome [ Tue Mar 01, 2011 9:53 pm ] |
Post subject: | Re: Problem with time.month |
Richard, That's correct, the months are returned between 0 and 11, as is customary in UNIX APIs. (e.g. http://linux.die.net/man/3/gmtime_r) The Month data type is an eC enumeration: public enum Month { january, february, march, april, may, june, july, august, september, october, november, december }; So its possible values really are from january to december, not 0 - 11. That is probably what the conversion warning or error you saw was about, it was warning you against assigning an int to a Month. So yes, you need to add +1 (or subtract) as appropriate for a numeric month representation. Congratulations on getting your program running! I guess it was a good learning experience, and it's a good thing I was too busy to do it all for you Regards, Jerome |
Author: | richard567 [ Wed Mar 02, 2011 3:27 pm ] |
Post subject: | Re: Problem with time.month |
Thanks Jerome. A screen shot of my finished product can be viewed below: Updated 03-03-2011 with minor enhancements to finished product. Updated 03-15-2011 with more minor enhancements to finished product. You were a great help as you pointed me in the right direction where I needed further study. You also provided a few tidbits that I was not aware of which helped speed things up. Yes, I actually wanted to do as much of it myself as possible for learning purposes, however, sometimes a little helping hand is a good thing also. I think I need to rest my brain for a while. I will probably post at some later time with some more questions regarding the Ecere software. So far I only have 043 installed. Meanwhile, I shall be lurking off and on as time allows. Thanks again for your help. Richard |
Author: | redj [ Wed Mar 02, 2011 7:07 pm ] |
Post subject: | Re: Problem with time.month |
Richard, Please feel free to post snap shots of Ecere SDK / eC apps directly on the forums. Cheers, -redj PS: hey, webadmin! That's ok, right? (EDIT) |
Author: | richard567 [ Thu Mar 03, 2011 5:12 pm ] |
Post subject: | Re: Problem with time.month |
Thanks redj. Will do that. I changed the image on 03-03-2011 as I made minor enhancements since the original post. Richard |
All times are UTC-05:00 | Page 1 of 1 |
Powered by phpBB® Forum Software © phpBB Limited |