How would I print the date and time for the purposes of the build. Ie: When the console for my application starts up I want to do this:
Binary Build date: 03/03/2009 @ 10:00AM
I think this would be a super useful function for all applications to have behind the scenes for programmers, especially in a team environment.
Is there a simple way to do this using Visual Studio 2008 in C++. Thanks.
Following commands are available: Insert DateTime (⇧+⌘+I on OS X, Ctrl+Shift+I on Windows and Linux) - Inserts current date and/or time according to configured format ( format ) at the cursor position. Insert Date - Inserts current date according to configured format ( formatDate ) at the cursor position.
User guide. Open the tool window from the top menu View -> Other Windows -> Build Timer. Start building your Visual Studio solution. Build Timer records time spent building each project and creates a timeline presented as a bar chart.
To access the current system date as a String , use the DateString property. To get or set the current system time, use the TimeOfDay property.
Similar to Virne's answer I created a simple header file called "BuildDate.h" with the following contents:
#define BUILD_DATE __DATE__ " " __TIME__
I touch the file using GnuWin32 touch command in my pre-build event:
touch.exe BuildDate.h
Then I include the header file in any code where I want access to the BUILD_DATE
string. E.g.:
#include "BuildDate.h"
...
logger->Log("Build Date: " BUILD_DATE);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With