If adjusting a connected irrigation controller's display skips a morning run or makes it appear twice, verify calendar triggers separately from run duration before blaming oscillator accuracy.
On a logic prototype for a park drip controller, a staff member changes the device time from a phone. A forward jump can skip a start time; a backward jump can make the same time occur twice. These happen at synchronization, not through gradual crystal drift. Use calendar time to decide when a job starts and independent elapsed time for a job already running. This article covers software, clocks and bench validation with logs and simulated loads, not valves, pumps or connected irrigation lines.
Calendar alarms and elapsed timers serve different purposes
A real-time clock stores date and time for a schedule at a given time of day. Epson's RX8130CE, ordering code X1B000311000100, is an example with an internal 32.768 kHz crystal and an I²C interface. It provides calendar counting, alarms and a wake timer separately. Use register status to distinguish calendar comparisons from timer expiry. An interrupt is not evidence the irrigation job completed, and writing a corrected time need not emit an alarm for a skipped instant.
A rule such as starting a zone at 06:00 each day uses calendar time. The eight-minute duration of a simulated run already under way uses elapsed time. A monotonic clock does not jump back when someone adjusts the calendar. It can still reset, and whether it continues in suspend depends on the platform. For a hardware counter or asynchronous timer, validate sleep, resets and clock switching. A saved count is not necessarily a valid baseline after reboot.
One morning, two ways to get the wrong number of runs
Suppose zone A is scheduled at 06:00. Changing the display from 05:59:30 to 06:02 jumps 2 minutes 30 seconds and skips the scheduled instant. Code that accepts a job only when it reads exactly 06:00 may miss it entirely. Under a no-catch-up policy, log a skipped occurrence. If approved testing permits a limited catch-up window, first check that the occurrence has not already been accepted. Do not replay every calendar time crossed. This example does not select a field policy.
Now suppose the 06:00 run was logged. At 06:04 the clock is moved back to 05:57, then reaches 06:00 again. Matching hour and minute alone can create a duplicate. Use rule ID, target zone, applicable date and occurrence ID as a run key. Base the key on the scheduled occurrence, not detection time; otherwise detecting it twice still creates two keys. Distinct rules or slots for one zone need distinct occurrences rather than one date-only key.
Suppose a bench run starts at 06:00 and three minutes elapse before someone moves the calendar forward by five minutes. An eight-minute run still has five minutes left. Subtracting the original start from the new wall time incorrectly adds the jump to elapsed time. Moving the clock back can make the calculated elapsed time shrink. Record both timelines to preserve the clock correction and the true duration.
Test the scheduler without operating field equipment
Disconnect actuators on the isolated logic bench and use simulated states or indicators. Record a baseline without clock changes: schedule, RTC reads, monotonic count, event source, run key and outcome. Then test a forward skip, a repeated time after a backward correction and a correction during a run. Distinguish an RTC alarm, host detection of a crossed time and a display-only change. A changed phone display does not prove the RTC write or schedule recalculation succeeded.
Also test simultaneous paths, such as an alarm and a recalculation both finding the same occurrence. Both must use the same deduplication check. If that must survive reboot, persist acceptance and the occurrence key, and define what recovery does with jobs accepted but with unknown outcome. Do not assume all retries are safe or clear history to make a test pass.
Log the correction source too. A manual change, local settings update and remote synchronization can occur close together. Record old and new time, source and application order. If the time is untrusted, follow the project's confirmation or exception policy rather than inferring past occurrences from the new reading. This separates RTC problems from schedule policy, retries and recovery logic.
Verify more than “clock works” at release
| Check | Engineering or software evidence | Purchasing and quality record |
|---|---|---|
| Calendar and RTC | Time before and after writes, alarm and timer sources | Full code, interface, source and package |
| Skipped start | Forward jump, occurrence key and required behavior | Firmware, product policy and test setup |
| Repeated start time | Acceptance after rollback and reboot comparison | Repeat the case and keep raw logs |
| Active run duration | Monotonic count and simulated start/finish | No field equipment attached; preserve repeatability |
Ask suppliers about the calendar, alarm and timer behavior used by the software, not just accuracy. If a substitute differs in interrupt status, clearing or counting, record the exact code and run the same three bench cases before approving it. Hardware timekeeping is only part of substitution qualification.
Also test a backward adjustment across midnight. Clearing all deduplication state on a date change can erase the previous day's acceptance evidence and make an already-accepted occurrence look new.
Frequently asked questions
Would a more accurate crystal stop the 06:00 run from being skipped? Not necessarily. Crystal accuracy controls long-term drift. A manual forward jump can skip an exact-match trigger regardless of oscillator accuracy.
If no duplicate ran, is one “complete” marker sufficient? No. A skipped trigger, accepted occurrence, completed job and unknown outcome need different evidence. At least retain the occurrence key and final result so a blocked duplicate can be distinguished from incorrectly merging two jobs.
