Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
emscripten-core
GitHub Repository: emscripten-core/emscripten
Path: blob/main/test/browser/test_glfw_time.c
4150 views
1
/*
2
* Copyright 2017 The Emscripten Authors. All rights reserved.
3
* Emscripten is available under two separate licenses, the MIT license and the
4
* University of Illinois/NCSA Open Source License. Both these licenses can be
5
* found in the LICENSE file.
6
*/
7
8
#include <assert.h>
9
#include <stdio.h>
10
#include <GLFW/glfw3.h>
11
12
int main() {
13
if (!glfwInit()) {
14
return 1;
15
}
16
17
float t = glfwGetTime();
18
printf("glfwGetTime() = %f\n", t);
19
20
printf("glfwSetTime(50)\n");
21
glfwSetTime(50);
22
23
// Expect time to be slightly greater than what we set
24
t = glfwGetTime();
25
printf("glfwGetTime() = %f\n", t);
26
assert(t < 50 + 1e-3);
27
28
glfwTerminate();
29
30
return 0;
31
}
32
33