From ee8a2b07738562cbea65a387bedc9441c35c0f1c Mon Sep 17 00:00:00 2001 From: Caisking <3449750381@qq.com> Date: Mon, 6 May 2024 10:57:22 +0800 Subject: [PATCH] =?utf8?q?=E4=BF=AE=E5=A4=8D=E8=A1=A8=E7=9B=98=E6=97=B6?= =?utf8?q?=E9=97=B4=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../fd230app/nativeui/main/src/dial/DialModelTime.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialModelTime.cpp b/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialModelTime.cpp index 656f24eaf..afc9a9e9b 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialModelTime.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialModelTime.cpp @@ -70,17 +70,18 @@ static float ConvertHandSecondValueToAngle(int32_t handValue, uint16_t range) void DialModelTime::UpdateTime() { -#if 1 +#if 0 struct timeval tv; gettimeofday(&tv, NULL); tblock_ = localtime(&tv.tv_sec); int realMS = tblock_->tm_sec * S_MS_US_TRANS + tv.tv_usec / S_MS_US_TRANS; -#elif +#else /*优化为更安全的localtime_r()*/ struct timeval tv; gettimeofday(&tv, NULL); struct tm tblock; localtime_r(&tv.tv_sec, &tblock); + tblock_ = &tblock; int realMS = tblock.tm_sec * S_MS_US_TRANS + tv.tv_usec / S_MS_US_TRANS; #endif -- 2.17.1