# jwkerr/clock architecture

> Architecture diagram of the GitHub repository jwkerr/clock, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jwkerr/clock
- Repository: https://github.com/jwkerr/clock

## Overview

This is a native analogue-clock practice app for a student, with teacher controls. The workflow starts from the computer’s current time, opens an interactive dial, and lets a user read or adjust the time; teacher controls can change the display and allow independent hand movement. The UI and timekeeping logic are implemented in the two core source files. The README documents capabilities not fully visible in the UI excerpt; those are represented without inferring additional internal calls.

Main entry points: [`src/ui.rs`](https://github.com/jwkerr/clock/blob/master/src/ui.rs) (Clock app state), [`src/clock.rs`](https://github.com/jwkerr/clock/blob/master/src/clock.rs) (Clock time and hand math), [`src/main.rs`](https://github.com/jwkerr/clock/blob/master/src/main.rs) (Native app startup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_startup["Application startup"]
  node_entry["Native app startup<br/>[main.rs]"]
end

subgraph group_interface["Clock interface"]
  node_app["Clock app state<br/>[ui.rs]"]
  node_controls["Teacher controls<br/>[ui.rs]"]
  node_dial["Clock face<br/>[ui.rs]"]
  node_drag["Hand interaction<br/>[ui.rs]"]
end

subgraph group_timekeeping["Timekeeping"]
  node_time["Clock time and hand math<br/>[clock.rs]"]
end

node_user(("Student / teacher"))

node_entry -->|"initializes time"| node_time
node_entry -->|"starts app"| node_app
node_user -->|"sets options"| node_controls
node_user -->|"reads or drags"| node_dial
node_app -->|"shows controls"| node_controls
node_app -->|"shows dial"| node_dial
node_controls -->|"updates settings"| node_app
node_drag -->|"moves linked hands"| node_time
node_dial -->|"gets hand turns"| node_time
node_app -->|"handles pointer input"| node_drag

click node_entry "https://github.com/jwkerr/clock/blob/master/src/main.rs"
click node_app "https://github.com/jwkerr/clock/blob/master/src/ui.rs"
click node_controls "https://github.com/jwkerr/clock/blob/master/src/ui.rs"
click node_dial "https://github.com/jwkerr/clock/blob/master/src/ui.rs"
click node_drag "https://github.com/jwkerr/clock/blob/master/src/ui.rs"
click node_time "https://github.com/jwkerr/clock/blob/master/src/clock.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry toneBlue
class node_app,node_controls,node_dial,node_drag toneAmber
class node_time toneMint
class node_user toneIndigo
```

## Components

### Application startup

- [Native app startup](https://github.com/jwkerr/clock/blob/master/src/main.rs): `src/main.rs`

### Clock interface

- [Clock app state](https://github.com/jwkerr/clock/blob/master/src/ui.rs): `src/ui.rs`
- [Teacher controls](https://github.com/jwkerr/clock/blob/master/src/ui.rs): `src/ui.rs`
- [Clock face](https://github.com/jwkerr/clock/blob/master/src/ui.rs): `src/ui.rs`
- [Hand interaction](https://github.com/jwkerr/clock/blob/master/src/ui.rs): `src/ui.rs`

### Timekeeping

- [Clock time and hand math](https://github.com/jwkerr/clock/blob/master/src/clock.rs): `src/clock.rs`

### Other components

- **Student / teacher**

## Connections

- Native app startup → Clock time and hand math: initializes time (evidence: `src/main.rs`)
- Native app startup → Clock app state: starts app (evidence: `src/main.rs`)
- Student / teacher → Teacher controls: sets options (evidence: `README.md`)
- Student / teacher → Clock face: reads or drags (evidence: `README.md`)
- Clock app state → Teacher controls: shows controls (evidence: `src/ui.rs`)
- Clock app state → Clock face: shows dial (evidence: `src/ui.rs`)
- Teacher controls → Clock app state: updates settings (evidence: `src/ui.rs`)
- Hand interaction → Clock time and hand math: moves linked hands (evidence: `src/ui.rs`)
- Clock face → Clock time and hand math: gets hand turns (evidence: `src/ui.rs`)
- Clock app state → Hand interaction: handles pointer input (evidence: `src/ui.rs`)
