Files
trail-mate/apps/linux_lvgl/tests/linux_time_write_test.cpp
T
Trail Mate Dev 6e613e382e Add CM0 Linux support and share device services across platforms
Compose the CM0 fullscreen application and standard Debian package, align the
Cardputer Zero shell, and share protocol, configuration, audio and storage
services with embedded targets through existing platform seams.

Add the paginated on-device TMAP creator using Center's published producer,
private workspace recovery and direct keyboard shortcuts. Preserve unfinished
management work behind its existing opt-in capability.

Include native, ARM and shared-core regression fixtures, integration records,
packaging helpers and dependency/license updates. Keep local build trees,
device credentials, produced packages and validation logs outside version control.

Validation before integration: ESP stack hygiene, Reticulum scope guard, staged
whitespace checks and GitNexus scope audit. Prior device/build evidence and
remaining hardware/package boundaries are recorded in the acceptance documents.
2026-10-29 10:29:29 +08:00

41 lines
1.3 KiB
C++

#include "platform/ui/settings_store.h"
#include "platform/ui/time_runtime.h"
#include <cassert>
#include <cerrno>
#include <limits>
namespace
{
unsigned calls = 0;
int failure = 0;
clockid_t destination;
timespec observed{};
} // namespace
extern "C" int clock_settime(clockid_t clock, const struct timespec* value) noexcept
{
++calls;
destination = clock;
observed = *value;
errno = failure;
return failure ? -1 : 0;
}
// Link unrelated timezone functions without touching persistent device settings.
namespace platform::ui::settings_store
{
int get_int(const char*, const char*, int fallback) { return fallback; }
void put_int(const char*, const char*, int) { assert(false); }
} // namespace platform::ui::settings_store
int main()
{
using platform::ui::time::set_utc_time;
assert(!set_utc_time(-1) && calls == 0);
assert(set_utc_time(1700000000));
assert(calls == 1 && destination == CLOCK_REALTIME && observed.tv_sec == 1700000000 && observed.tv_nsec == 0);
failure = EPERM;
assert(!set_utc_time(1700000001) && calls == 2);
failure = EINVAL;
assert(!set_utc_time(std::numeric_limits<time_t>::max()) && calls == 3);
assert(observed.tv_sec == std::numeric_limits<time_t>::max());
// No real clock write occurs: the process-local syscall symbol is interposed.
}