Files
makronix/mobile/tools/phone-time.sh
T
lotherkandClaude Sonnet 5.5 73c9de51a6 licence: the CNCL line in every file Makronix wrote (tools, docs, www, mobile, top level)
consmirror.c: the BSD notice is replaced (Makronix's own file).  Files with
changes of other sessions pending are left for their commit.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-14 11:50:26 +00:00

16 lines
539 B
Bash

#!/bin/sh
# License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree.
#
# Set the running phone's clock to the host's and save its offset to the
# PMIC RTC (rtc-offset(1), soc/sm8150/rootfs/usr/bin), so the phone keeps
# the time across reboots. Over ssh, at the address phone_addr finds
# (tools/lib.sh). Precision: the second.
#
# Usage: phone-time.sh
set -eu
. "$(dirname "$0")/lib.sh"
a=$(phone_addr) || die "phone not reachable"
phone_ssh "$a" "date -u -s @$(date +%s) >/dev/null && rtc-offset save && date -u"