Fixed writing and reading time on the board

This commit is contained in:
Yury Shuvakin
2022-11-03 06:28:54 +03:00
parent 868a810eda
commit 2595c7bb65

View File

@@ -102,7 +102,7 @@ ColumnLayout {
Tumbler { Tumbler {
id: yearTumbler id: yearTumbler
model: range(1970, 230) model: range(2000, 200)
delegate: tumblerComponent delegate: tumblerComponent
Layout.alignment: Qt.AlignCenter Layout.alignment: Qt.AlignCenter
Layout.fillWidth: true Layout.fillWidth: true
@@ -187,7 +187,7 @@ ColumnLayout {
onClicked: { onClicked: {
const date = new Date() const date = new Date()
yearTumbler.currentIndex = date.getFullYear() - 1970 yearTumbler.currentIndex = date.getFullYear() - 2000
monthTumbler.currentIndex = date.getMonth() monthTumbler.currentIndex = date.getMonth()
dayTumbler.currentIndex = date.getDate() - 1 dayTumbler.currentIndex = date.getDate() - 1
@@ -210,7 +210,8 @@ ColumnLayout {
date.setMinutes(minutesTumbler.currentIndex) date.setMinutes(minutesTumbler.currentIndex)
date.setSeconds(secondsTumbler.currentIndex) date.setSeconds(secondsTumbler.currentIndex)
BmsInterface.commands().sendTerminalCmd("setUnixTime " + Math.round(date / 1000)) const localTimestamp = (Math.round(date / 1000) - date.getTimezoneOffset() * 60).toString(16)
BmsInterface.commands().sendTerminalCmd("setUnixTime " + localTimestamp)
} }
} }
} }