1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-24 00:35:26 +03:00

Merge pull request #1178 from mikeller/add_time_ticks

Added setting of time in ticks.
This commit is contained in:
Michael Keller 2018-08-31 09:35:06 +12:00 committed by GitHub
commit 0ec25ccf50
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1667,13 +1667,21 @@ MspHelper.prototype.crunch = function(code) {
break;
case MSPCodes.MSP_SET_RTC:
var now = new Date();
buffer.push16(now.getUTCFullYear());
buffer.push8(now.getUTCMonth() + 1);
buffer.push8(now.getUTCDate());
buffer.push8(now.getUTCHours());
buffer.push8(now.getUTCMinutes());
buffer.push8(now.getUTCSeconds());
var now = Date.now();
if (semver.gte(CONFIG.apiVersion, "1.41.0")) {
var secs = now / 1000;
var millis = now % 1000;
buffer.push32(secs);
buffer.push16(millis);
} else {
buffer.push16(now.getUTCFullYear());
buffer.push8(now.getUTCMonth() + 1);
buffer.push8(now.getUTCDate());
buffer.push8(now.getUTCHours());
buffer.push8(now.getUTCMinutes());
buffer.push8(now.getUTCSeconds());
}
break;
default: