Skip to content

Commit 0473a4b

Browse files
committed
MPI tutorial to use chrono::steady_clock like GLFWOSPRayWindow
1 parent a5f7224 commit 0473a4b

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

modules/mpi/tutorials/GLFWDistribOSPRayWindow.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "GLFWDistribOSPRayWindow.h"
55
#include <mpi.h>
66
#include <ospray/ospray_util.h>
7+
#include <chrono>
78
#include <iostream>
89
#include <stdexcept>
910
#include "imgui.h"
@@ -289,7 +290,7 @@ void GLFWDistribOSPRayWindow::motion(const vec2f &position)
289290
void GLFWDistribOSPRayWindow::display()
290291
{
291292
// clock used to compute frame rate
292-
static auto displayStart = std::chrono::high_resolution_clock::now();
293+
static auto displayStart = std::chrono::steady_clock::now();
293294

294295
if (showUi && uiCallback) {
295296
ImGuiWindowFlags flags = ImGuiWindowFlags_AlwaysAutoResize;
@@ -305,8 +306,8 @@ void GLFWDistribOSPRayWindow::display()
305306
static bool firstFrame = true;
306307
if (firstFrame || currentFrame.isReady()) {
307308
// display frame rate in window title
308-
auto displayEnd = std::chrono::high_resolution_clock::now();
309-
auto durationMilliseconds =
309+
const auto displayEnd = std::chrono::steady_clock::now();
310+
const auto durationMilliseconds =
310311
std::chrono::duration_cast<std::chrono::milliseconds>(
311312
displayEnd - displayStart);
312313

@@ -331,7 +332,7 @@ void GLFWDistribOSPRayWindow::display()
331332
framebuffer.unmap(fb);
332333

333334
// Start new frame and reset frame timing interval start
334-
displayStart = std::chrono::high_resolution_clock::now();
335+
displayStart = std::chrono::steady_clock::now();
335336
firstFrame = false;
336337
}
337338

0 commit comments

Comments
 (0)