how to get building time and compile time w cpp or w some api

need to get building time and compile time w cpp
using what OS & tools?
Windows 10/QT Creator
I don't know QT, but with Visual Studio and Code::Blocks there's an output window that shows the results of a workspace/project/solution compile process that includes the total time of the process.

Compiling in MSVC:
1
2
3
4
5
6
#include <iostream>

int main()
{
    std::cout << "Hello World!\n";
}

yields generates this build log:
Build started...
1>------ Build started: Project: Project1, Configuration: Release x64 ------
1>Project1.cpp
1>Generating code
1>Previous IPDB not found, fall back to full compilation.
1>All 10 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
1>Finished generating code
1>Project1.vcxproj -> C:\Programming\My Projects\Project1\x64\Release\Project1.exe
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Elapsed 00:03.236 ==========

You can even get timestamps for the elapsed process:
14:01:56:181	Build started...
14:01:56:298	1>------ Build started: Project: Project1, Configuration: Release x64 ------
14:01:56:624	1>Project1.cpp
14:01:58:017	1>Generating code
14:01:58:068	1>Previous IPDB not found, fall back to full compilation.
14:01:58:068	1>All 10 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
14:01:58:068	1>Finished generating code
14:01:58:330	1>Project1.vcxproj -> C:\Programming\My Projects\Project1\x64\Release\Project1.exe
14:01:59:415	========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
14:01:59:415	========== Elapsed 00:03.254 ==========

Code::Blocks 20.03 generates this build log:
-------------- Build: Release in CPlusPlus_Test (compiler: GNU GCC Compiler)---------------

g++.exe -Wall -fexceptions -O2  -c D:\Programming\Projects\Code_Blocks\CPlusPlus_Test\main.cpp -o obj\Release\main.o
g++.exe  -o bin\Release\CPlusPlus_Test.exe obj\Release\main.o  -s  
Output file is bin\Release\CPlusPlus_Test.exe with size 20.00 KB
Process terminated with status 0 (0 minute(s), 3 second(s))
0 error(s), 0 warning(s) (0 minute(s), 3 second(s))
Topic archived. No new replies allowed.