I have a simple program that uses chrono for timing that I had ported from MSVC to Code::Blocks. The display of the program shows the delta time from when it was started to 16 decimal places. After getting it to compile, I noticed that the timer was only moving up from the first 6 decimal places. The code remains unchanged, still using std::chrono::high_resolution_clock::now(); for the time, and then to calculate the delta time I use
double localDeltaTime = std::chrono::duration_cast<std::chrono::nanoseconds>(m_EndTime - m_StartTime).count();
localDeltaTime = localDeltaTime / 1000000000.0;
This clearly displays nanosecond timings, yet GCC only seems to do microseconds? Is this a known issue?
Edit:
Here is an MRE,
#include <chrono>
#include <iostream>
#include <iomanip>
int main()
{
std::chrono::high_resolution_clock::time_point start = std::chrono::high_resolution_clock::now();
std::chrono::high_resolution_clock::time_point finish = start;
while (true)
{
finish = std::chrono::high_resolution_clock::now();
long double deltaTime = std::chrono::duration_cast<std::chrono::nanoseconds>(finish - start).count();
deltaTime /= 1000000000.0;
std::cout << std::setprecision(25) << deltaTime << std::endl;
}
return 0;
}