git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Add compiled date to git --version output?

From
Brian Gernhardt <brian@gernhardtsoftware.com>
Date
Sep 18, 2009, 04:43 UTC
Message-ID
<F73940A6-02F5-48EE-BD11-FCEC5B21B054@gernhardtsoftware.com>
In-Reply-To
<544dda350909172117r44761577m11e7d30a1a5d0c91@mail.gmail.com>
On Sep 18, 2009, at 12:17 AM, Nazri Ramliy wrote:
> +       printf("git version %s compiled %s %s\n",
> +                       git_version_string,
> +                       __DATE__,
> +                       __TIME__);
> Thoughts?

Any idea how compatible that is? Sure, it'll work with GCC's cpp, but we try to work with a huge variety of compilers.

At the very least you might want to wrap it all in #ifdefs or something:

#if defined(__DATE__) && defined(__TIME__) /* your version */ #else /* old version */ #endif

(Or play fun tricks with #ifndef ... #define, but then you also have to play with the format string or something.)

~~Brian
Previous: Nazri RamliyNext: David Aguilar
Message 2 of 5 in “Add compiled date to git --version output?”
  1. Nazri RamliySep 18, 2009
  2. Brian GernhardtSep 18, 2009
  3. David AguilarSep 18, 2009
  4. Junio C HamanoSep 18, 2009
  5. Nazri RamliySep 18, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.