DATE and TIME in Codewarrior 7.2.2

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

DATE and TIME in Codewarrior 7.2.2

980 Views
vier_kuifjes
Senior Contributor I

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...

Labels (1)
0 Kudos
5 Replies

688 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

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"?

0 Kudos

688 Views
kef2
Senior Contributor IV

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.

688 Views
vier_kuifjes
Senior Contributor I

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.:smileyhappy:

0 Kudos

688 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

thank you Edward.

yes, CW doesn't have exact feature as Marc request.

please summit it as a SR as feature request to support@freescale.com

we will process.

0 Kudos

688 Views
kef2
Senior Contributor IV

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.

0 Kudos