From: luozheng <1732036298@qq.com> Date: Fri, 30 Aug 2024 06:52:37 +0000 (+0800) Subject: 倒计时界面使用%02d解决计数少于两位数补零 X-Git-Tag: release_V1.2.70_20241020_135402~529^2~49 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=067e1a9cc6882e3abbb4f2eee4fecf517e33cfa4;p=mirrors%2FFD230.git 倒计时界面使用%02d解决计数少于两位数补零 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/stopwatch/src/MainStopWatchPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/stopwatch/src/MainStopWatchPresenter.cpp index 540ec3514..f4e911078 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/stopwatch/src/MainStopWatchPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/stopwatch/src/MainStopWatchPresenter.cpp @@ -203,11 +203,11 @@ namespace OHOS char *PickerData = (char *)malloc(128); if (lastRecordTime == 0) // 如果是第一次标记 { - sprintf(PickerData, "%d %s +%s", RecordCycleNumber, formattedTime, formattedTime); + sprintf(PickerData, "%02d %s +%s", RecordCycleNumber, formattedTime, formattedTime); } else { - sprintf(PickerData, "%d %s +%s", RecordCycleNumber, formattedTime, formattedDiff); + sprintf(PickerData, "%02d %s +%s", RecordCycleNumber, formattedTime, formattedDiff); } m_listdata->PushFront(const_cast(PickerData)); m_listadapter->SetData(m_listdata);