mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-26 12:15:34 +08:00
[fix] use proper std::chrono clock
This commit is contained in:
@@ -320,7 +320,7 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
last_ts = static_cast<uint32_t>(
|
last_ts = static_cast<uint32_t>(
|
||||||
std::chrono::duration_cast<std::chrono::milliseconds>(
|
std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||||
std::chrono::high_resolution_clock::now().time_since_epoch())
|
std::chrono::steady_clock::now().time_since_epoch())
|
||||||
.count());
|
.count());
|
||||||
|
|
||||||
cd_cache_file = fopen("cache.cd", "r+");
|
cd_cache_file = fopen("cache.cd", "r+");
|
||||||
@@ -497,7 +497,7 @@ int main(int argc, char *argv[]) {
|
|||||||
screen_capturer_factory = new ScreenCapturerFactory();
|
screen_capturer_factory = new ScreenCapturerFactory();
|
||||||
screen_capturer = (ScreenCapturer *)screen_capturer_factory->Create();
|
screen_capturer = (ScreenCapturer *)screen_capturer_factory->Create();
|
||||||
|
|
||||||
last_frame_time_ = std::chrono::high_resolution_clock::now();
|
last_frame_time_ = std::chrono::steady_clock::now();
|
||||||
ScreenCapturer::RECORD_DESKTOP_RECT rect;
|
ScreenCapturer::RECORD_DESKTOP_RECT rect;
|
||||||
rect.left = 0;
|
rect.left = 0;
|
||||||
rect.top = 0;
|
rect.top = 0;
|
||||||
@@ -507,7 +507,7 @@ int main(int argc, char *argv[]) {
|
|||||||
int screen_capturer_init_ret = screen_capturer->Init(
|
int screen_capturer_init_ret = screen_capturer->Init(
|
||||||
rect, 60,
|
rect, 60,
|
||||||
[](unsigned char *data, int size, int width, int height) -> void {
|
[](unsigned char *data, int size, int width, int height) -> void {
|
||||||
auto now_time = std::chrono::high_resolution_clock::now();
|
auto now_time = std::chrono::steady_clock::now();
|
||||||
std::chrono::duration<double> duration =
|
std::chrono::duration<double> duration =
|
||||||
now_time - last_frame_time_;
|
now_time - last_frame_time_;
|
||||||
auto tc = duration.count() * 1000;
|
auto tc = duration.count() * 1000;
|
||||||
|
|||||||
@@ -66,12 +66,12 @@ int Render::StartScreenCapture() {
|
|||||||
rect.top = 0;
|
rect.top = 0;
|
||||||
rect.right = screen_width_;
|
rect.right = screen_width_;
|
||||||
rect.bottom = screen_height_;
|
rect.bottom = screen_height_;
|
||||||
last_frame_time_ = std::chrono::high_resolution_clock::now();
|
last_frame_time_ = std::chrono::steady_clock::now();
|
||||||
|
|
||||||
int screen_capturer_init_ret = screen_capturer_->Init(
|
int screen_capturer_init_ret = screen_capturer_->Init(
|
||||||
rect, 60,
|
rect, 60,
|
||||||
[this](unsigned char *data, int size, int width, int height) -> void {
|
[this](unsigned char *data, int size, int width, int height) -> void {
|
||||||
auto now_time = std::chrono::high_resolution_clock::now();
|
auto now_time = std::chrono::steady_clock::now();
|
||||||
std::chrono::duration<double> duration = now_time - last_frame_time_;
|
std::chrono::duration<double> duration = now_time - last_frame_time_;
|
||||||
auto tc = duration.count() * 1000;
|
auto tc = duration.count() * 1000;
|
||||||
|
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ int main(int argc, char *argv[]) {
|
|||||||
// Event Loop
|
// Event Loop
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
|
|
||||||
last_frame_time = std::chrono::high_resolution_clock::now();
|
last_frame_time = std::chrono::steady_clock::now();
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
// Wait
|
// Wait
|
||||||
@@ -249,7 +249,7 @@ int main(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
printf("xxxxxxxxxxxxxxxxxxx\n");
|
printf("xxxxxxxxxxxxxxxxxxx\n");
|
||||||
if (!got_picture) {
|
if (!got_picture) {
|
||||||
auto now_time = std::chrono::high_resolution_clock::now();
|
auto now_time = std::chrono::steady_clock::now();
|
||||||
std::chrono::duration<double> duration = now_time - last_frame_time;
|
std::chrono::duration<double> duration = now_time - last_frame_time;
|
||||||
auto tc = duration.count() * 1000;
|
auto tc = duration.count() * 1000;
|
||||||
printf("duration: %f\n", tc);
|
printf("duration: %f\n", tc);
|
||||||
|
|||||||
2
thirdparty/projectx
vendored
2
thirdparty/projectx
vendored
Submodule thirdparty/projectx updated: a308094fbd...911f209fda
Reference in New Issue
Block a user