I know about __DATE__ and __TIME__ in Codewarrior, but is there an easy way to have the numeric values of date and time available at compile time? I am particularly interested in the year number...
I don't understand your question. can you be more specific?
what means "have the numeric values of date and time available at compile time"?
I think Marc is interested not in strings like "Jan 16 2014" defined by __DATE__ standard C preprocessor macro, but about numeric value for date, or year, month and day. These could help when someone has lack of ROM to include __DATE__ string parsing and reformatting routines. For example compile date coded as a number or converted to more compact string could be easily send over CAN in single CAN message. Unfortunately standard C has only __DATE__ and __TIME__ strings in fixed format.
thank you Edward.
yes, CW doesn't have exact feature as Marc request.
please summit it as a SR as feature request to firstname.lastname@example.org
we will process.
Since it is not standard feature and other compiler vendors aren't going to add it even in the far future, I think Marc should try setting project to launch some external tool at pre build step to generate *.h file with date formatted as required.
When compiler IDE has no pre-build command setting, for generating only date *.h file, formtting tool can be launched from OS scheduler every day.
That's indeed what I'm looking for. I need the number of the year at compile time to do some calculations with (also at compile time). At this moment I just enter the value in a #define which is no big deal as I only need to change it once a year.
Retrieving data ...