Prev: Named RTOS objects
Next: Faster image rotation
From: Ed Prochak on 7 Apr 2010 01:02 On Apr 6, 9:44 pm, Tim Wescott <t...(a)seemywebsite.now> wrote: > a7yvm109gf...(a)netzero.com wrote: > > On Apr 6, 7:50 pm, NoEmail...(a)execpc.com (Chris Giese) wrote: > >> a7yvm109gf...(a)netzero.com wrote: > >>> Hello > >>> Back when I was doing assembler on the 8051, I used some compiler > >>> specific labels to include the date and time of compilation in a > >>> string. The microcontroller could then send out this information on > >>> request. > >>> How could I do this now? > >> #include <stdio.h> > >> int main(void) { printf("I was compiled on %s\n", __DATE__); return 0; } > > > I'm tickled pink by this, thanks. > > Was I searching for the wrong term, "timestamp"? This info didn't > > exactly pop out at me. > > Apparently! > > Note #1: __TIME__ and __DATE__ are part of the ANSI C standard; while > I'm sure there are compilers that don't support them, I haven't run into > one. > > Note #2: If you are interested in version control, one of the things > that you want is for a 'production' build for a particular version of > software to come out bit-exact each and every time. You want this, > because five years down the road when some Very Important Customer wants > Just One Change, or if you have to track down some Dread Bug, it is > exceedingly soothing to be able to verify that you can, indeed, check > out and rebuild some hex file that's going into production hardware. > > This rules out using time and date stamping _on production builds_. My > preferred process is to have a "version" header or source file that gets > changed to match the version, and which takes a "development code" flag > that tells it to insert compile time and date instead. > > -- > Tim Wescott > Control system and signal processing consultingwww.wescottdesign.com Yes time stamping the source files is better, but it is possible to do comparison scripts that check all but a small fixed set of bytes (those bytes being the time/date compiled). Had to do exactly that back in the late '80s. So again: do it with source file dates (generated by your Source code controls system). Ed |