Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 1 file). Show all
Unified · Split
| @@ -840,15 +840,6 @@ QScriptValue ScriptEngine::evaluate(const QString& sourceCode, const QString& fi · 839 unmodified lines | ||
| 840 | 840 | } |
| 841 | 841 | |
| 842 | 842 | void ScriptEngine::run() { |
| 843 | − | |
| 844 | −#ifdef _WIN32 | |
| 845 | − // VS13 does not sleep_until unless it uses the system_clock, see: | |
| 846 | − // https://www.reddit.com/r/cpp_questions/comments/3o71ic/sleep_until_not_working_with_a_time_pointsteady/ | |
| 847 | − using clock = std::chrono::system_clock; | |
| 848 | −#else | |
| 849 | − using clock = std::chrono::high_resolution_clock; | |
| 850 | −#endif | |
| 851 | − | |
| 852 | 843 | if (DependencyManager::get<ScriptEngines>()->isStopped()) { |
| 853 | 844 | return; // bail early - avoid setting state in init(), as evaluate() will bail too |
| 854 | 845 | } |
| @@ -862,6 +853,14 @@ void ScriptEngine::run() { · 7 unmodified lines | ||
| 862 | 853 | |
| 863 | 854 | QScriptValue result = evaluate(_scriptContents, _fileNameString); |
| 864 | 855 | |
| 856 | +#ifdef _WIN32 | |
| 857 | + // VS13 does not sleep_until unless it uses the system_clock, see: | |
| 858 | + // https://www.reddit.com/r/cpp_questions/comments/3o71ic/sleep_until_not_working_with_a_time_pointsteady/ | |
| 859 | + using clock = std::chrono::system_clock; | |
| 860 | +#else | |
| 861 | + using clock = std::chrono::high_resolution_clock; | |
| 862 | +#endif | |
| 863 | + | |
| 865 | 864 | clock::time_point startTime = clock::now(); |
| 866 | 865 | int thisFrame = 0; |
| 867 | 866 | |