Solved

Getting time and date with preprocessor

Posted on 2001-07-02
3
420 Views
Last Modified: 2008-03-10
In my application I want to display the build time and date in about box.
That is the time/date the EXE was built.
Therefore I need the actual time and date at compile time.

Anybody know an easy way to get this time and date?
I don't want to take the file date at run-time.

A preprocessor macro would be fine.
Any ideas ?

0
Comment
Question by:Pacman
  • 2
3 Comments
 
LVL 9

Author Comment

by:Pacman
ID: 6244237
Compiler is MS VC6.0 ...
doesn't have to be ANSI solution
0
 
LVL 2

Accepted Solution

by:
GloriousRain earned 100 total points
ID: 6244260
To help you perform such processing, the C preprocessor assigns the constants __DATE__ and __TIME__ to the current date and time.
Ex:
printf("Beta testing: Last compiled %s %s", __DATE__, __TIME__);
0
 
LVL 9

Author Comment

by:Pacman
ID: 6244346
That's it!
Thank you
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question