Skip to content

v2.4.3 - Propagate set_rtc_time() Error Return Value (2026-02-24)

What Changed?

This release fixes set_rtc_time() to propagate the error return value from settimeofday(). Previously, Command::set_rtc_time() always returned true even if the underlying system call failed. Now the full error path is wired: settimeofday()rtc_set_time()Command::set_rtc_time()SET_RTC_TIME handler.


What's New

Main Feature: Propagate settimeofday() Error Through RTC Call Chain

What it does:

Wires the error return value through 4 layers:

settimeofday()          // POSIX: returns 0 on success, -1 on failure
    ↓
rtc_set_time()          // void → bool: returns false if settimeofday() fails
    ↓
Command::set_rtc_time() // always true → propagates rtc_set_time() result
    ↓
handle_set_rtc_time()   // ignored → returns DEVICE_CODE_UNKNOWN error response

Why it matters:

  • If settimeofday() fails, the device was silently reporting success to the host
  • The host would believe RTC was set, but detection timestamps would still be wrong
  • Now the host receives an error response and can retry or alert the user

Installation

Quick Start

# Get the release
git checkout 2.4.3

# Build
task v2:build

# Upload
task v2:upload

# Check it works
task monitor

What's Different from the Last Version?

🐛 Fixed

  • include/rtc_manager.h: rtc_set_time() return type voidbool
  • src/rtc_manager.cpp: settimeofday() return value checked; false on failure
  • src/v2_command.cpp: Command::set_rtc_time() propagates rtc_set_time() result
  • src/command/rtc.cpp: handle_set_rtc_time() returns DEVICE_CODE_UNKNOWN error if RTC set fails

Is It Safe to Upgrade?

Backward Compatible: Yes

  • On ESP32, settimeofday() succeeds in virtually all cases (no POSIX permission restrictions)
  • No change in normal behavior; only affects the rare failure path

Tests Passed

  • ✅ Builds without errors

Release Details

  • Date: 2026-02-24
  • Version: v2.4.3
  • Files Changed: 4 (include/rtc_manager.h, src/rtc_manager.cpp, src/v2_command.cpp, src/command/rtc.cpp)

Next Steps

Continued code quality improvements (see REFACTORING_ROADMAP.md):

  • Remove double discard_input() call (P2)
  • Add V2_ prefix to include guards (P2)