summaryrefslogtreecommitdiff
path: root/source/util/Clock.mc
diff options
context:
space:
mode:
authorcirakg <cirakg@cirakg.xyz>2026-10-19 22:28:09 +0200
committercirakg <cirakg@cirakg.xyz>2026-10-19 22:28:09 +0200
commit35042ff04ffc50e55ff59a385849442be4429d6b (patch)
tree3c142dd9bfb995b7aacdf39128e591dd3f9370de /source/util/Clock.mc
parent871aba901501302586895d266fe4569665d9fe70 (diff)
feat(ui): add the list, OTP detail, PIN entry, menu, info screens and glance
List with live codes and countdowns, adaptive rows and lazy headers; OTP detail with ring or bar, next code and HOTP next; PIN keypad or button selector with create, unlock, change, lockout display and pending promotion; native menu; glance with the entry count; self-test after the first frame; option properties with defaults. Codes are computed one per timer event, apart from drawing, for the watchdog. A UI-test build (uitest.jungle) starts with fake entries, PIN 123456 and a frozen clock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'source/util/Clock.mc')
-rw-r--r--source/util/Clock.mc6
1 files changed, 6 insertions, 0 deletions
diff --git a/source/util/Clock.mc b/source/util/Clock.mc
index 4e2faf4..44a0e37 100644
--- a/source/util/Clock.mc
+++ b/source/util/Clock.mc
@@ -22,11 +22,17 @@ module Clock {
// Current unix time (UTC seconds) plus the user's offset for clock skew.
function nowUnix(offsetSeconds as Number) as Long {
+ if (TestMode.ON) {
+ return TestMode.NOW + offsetSeconds;
+ }
return toUnsigned(Time.now().value()) + offsetSeconds;
}
// The trusted clock's unix time, or null when it isn't synced yet.
function trustedUnix() as Long? {
+ if (TestMode.ON) {
+ return TestMode.NOW;
+ }
try {
return toUnsigned(Time.getCurrentTime({:currentTimeType => Time.CURRENT_TIME_RTC}).value());
} catch (e instanceof Time.RealTimeClockNotValidException) {