Sujet : Re: g++ v14.1.0
De : Bonita.Montero (at) *nospam* gmail.com (Bonita Montero)
Groupes : comp.lang.c++Date : 17. Dec 2024, 07:52:37
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vjr73j$1j9tc$1@raubtier-asyl.eternal-september.org>
References : 1
User-Agent : Mozilla Thunderbird
Am 17.12.2024 um 05:39 schrieb Student Project:
Do you guys see any problems in this simple code:
struct Timer
{
std::chrono::time_point<std::chrono::steady_clock> start, end;
std::chrono::duration<float> duration;
Timer()
{
start = std::chrono::high_resolution_clock::now();
std::chrono::time_point<std::chrono::high_resolution_clock> start, end;
}
~Timer()
{
end = std::chrono::high_resolution_clock::now();
duration = end - start;
float ms = duration.count() * 1000.0f;
std::cout << "Timer took: " << ms << "ms\n";
}
};
That's while steady_clock and system_clock are the same with MSVC
(both rely on GetSystemTimeAsFileTime()).