You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(clock): move DurationSinceUnixEpoch to torrust-tracker-clock (torrust#1790)
Move the `DurationSinceUnixEpoch` type alias from `torrust-tracker-primitives`
into `torrust-tracker-clock`, where it semantically belongs as it measures
time relative to the Unix epoch — a clock-domain concept.
Changes:
- `torrust-tracker-clock`: add `pub type DurationSinceUnixEpoch = std::time::Duration`
- `torrust-tracker-clock/Cargo.toml`: remove `torrust-tracker-primitives` dependency
- `torrust-tracker-primitives/src/lib.rs`: replace type definition with
`#[deprecated] pub use torrust_tracker_clock::DurationSinceUnixEpoch`
for backward compatibility
- `torrust-tracker-primitives/src/peer.rs`: import `DurationSinceUnixEpoch`
directly from `torrust_tracker_clock` to avoid triggering the deprecation
warning internally
- `torrust-tracker-metrics/Cargo.toml`: replace `torrust-tracker-primitives`
dep with `torrust-tracker-clock`
- All workspace consumers (77 files): update import path from
`torrust_tracker_primitives::DurationSinceUnixEpoch` to
`torrust_tracker_clock::DurationSinceUnixEpoch`
- Issue spec and EPIC updated
Resolvestorrust#1790.
| SI-02 |[#1790](https://github.com/torrust/torrust-tracker/issues/1790) — Move `DurationSinceUnixEpoch` from `torrust-tracker-primitives` to `torrust-tracker-clock`|[docs/issues/open/1790-move-duration-since-unix-epoch-to-torrust-tracker-clock.md](../../open/1790-move-duration-since-unix-epoch-to-torrust-tracker-clock.md)|TODO| Rule M; no hard blockers; prerequisite for SI-13 |
228
+
| SI-02 |[#1790](https://github.com/torrust/torrust-tracker/issues/1790) — Move `DurationSinceUnixEpoch` from `torrust-tracker-primitives` to `torrust-tracker-clock`|[docs/issues/open/1790-move-duration-since-unix-epoch-to-torrust-tracker-clock.md](../../open/1790-move-duration-since-unix-epoch-to-torrust-tracker-clock.md)|DONE| Rule M; no hard blockers; prerequisite for SI-13 |
229
229
| SI-03 | #TBD — Move `DEFAULT_TIMEOUT` from `torrust-tracker-configuration` to `torrust-tracker-clock`|[docs/issues/drafts/1669-03-move-default-timeout-from-configuration-to-clock.md](../../drafts/1669-03-move-default-timeout-from-configuration-to-clock.md)| TODO | Rule M; no blockers; prerequisite for SI-09 (clock rename) |
230
230
| SI-04 | #TBD — Move `AnnouncePolicy` from `torrust-tracker-configuration` to `torrust-tracker-primitives`|[docs/issues/drafts/1669-04-move-announce-policy-to-torrust-tracker-primitives.md](../../drafts/1669-04-move-announce-policy-to-torrust-tracker-primitives.md)| TODO | Rule M; fixes inverted dep (primitives → configuration); no blockers |
231
231
| SI-05 | #TBD — Create `torrust-net-primitives` and move `ServiceBinding` from `torrust-tracker-primitives`|[docs/issues/drafts/1669-05-create-torrust-net-primitives-and-move-service-binding.md](../../drafts/1669-05-create-torrust-net-primitives-and-move-service-binding.md)| TODO | Rule M + new package; generic networking type; breaks server-lib → tracker-primitives dep |
@@ -334,8 +334,8 @@ against this constraint (verified May 2026).
334
334
|`torrust-tracker-contrib-bencode`| Yes | None | ✅ Now | Extraction subissue exists; no blockers |
335
335
|`bittorrent-peer-id`| No | None | ✅ Now | No spec yet; can be extracted first in the `bittorrent-*` sequence |
336
336
|`torrust-tracker-located-error`| Yes | None | ✅ Already published | No extraction spec yet |
337
-
|`torrust-tracker-clock` (→ `torrust-clock`) | Yes |`torrust-tracker-primitives`(published ✅); `DurationSinceUnixEpoch` will be removed by follow-up subissue| ✅ After rename + move| See [extract clock subissue](../../drafts/1669-13-extract-torrust-clock-to-standalone-repo.md)|
338
-
|`torrust-tracker-metrics` (→ `torrust-metrics`) | No |`torrust-tracker-primitives` (published ✅) | ✅ After rename | See [extract metrics subissue](../../drafts/1669-14-extract-torrust-metrics-to-standalone-repo.md)|
337
+
|`torrust-tracker-clock` (→ `torrust-clock`) | Yes |None (✅ `torrust-tracker-primitives`dep removed by SI-02 #1790) | ✅ After rename | See [extract clock subissue](../../drafts/1669-13-extract-torrust-clock-to-standalone-repo.md)|
338
+
|`torrust-tracker-metrics` (→ `torrust-metrics`) | No |`torrust-tracker-clock` (published ✅; was `torrust-tracker-primitives` — removed by SI-02 #1790)| ✅ After rename | See [extract metrics subissue](../../drafts/1669-14-extract-torrust-metrics-to-standalone-repo.md)|
339
339
|`bittorrent-udp-tracker-protocol`| No |`bittorrent-peer-id` (not published) | ❌ | After `bittorrent-peer-id`|
340
340
|`bittorrent-tracker-core`| No |`torrust-tracker-events`, `torrust-tracker-metrics`, `torrust-tracker-swarm-coordination-registry`, `torrust-rest-tracker-api-client` (all unpublished) | ❌ Very deep chain | After all four above; also has `torrust-rest-tracker-api-client` as a runtime dep — a layer violation worth resolving before extraction |
341
341
|`bittorrent-http-tracker-protocol`| No |`bittorrent-udp-tracker-protocol`, `bittorrent-tracker-core` (both unpublished) | ❌ | After `bittorrent-udp-tracker-protocol` and `bittorrent-tracker-core`|
| T1 |TODO| Define `DurationSinceUnixEpoch` in `packages/clock/src/lib.rs`|`pub type DurationSinceUnixEpoch = std::time::Duration;`|
101
-
| T2 |TODO| Update `packages/clock/src/clock/mod.rs` and `packages/clock/src/conv/mod.rs` to use the local definition | Replace `use torrust_tracker_primitives::DurationSinceUnixEpoch` with local import |
102
-
| T3 |TODO| Remove `torrust-tracker-primitives` dep from `packages/clock/Cargo.toml`| Dep entry removed; workspace build still passes |
103
-
| T4 |TODO| Update all 80+ workspace files to import `DurationSinceUnixEpoch` from `torrust_tracker_clock` instead of `torrust_tracker_primitives`| Use M1 grep to find the full file list; one-line change per file |
104
-
| T5 |TODO| Run `cargo build --workspace` and `cargo test --workspace`| Clean build and all tests pass |
105
-
| T6 |TODO| Run `linter all`| Exit code `0`|
106
-
| T7 |TODO| Update EPIC #1669 extraction ordering table: note that `torrust-tracker-clock` has no `torrust-tracker-primitives` dep |`torrust-tracker-clock` row: `torrust-tracker-primitives` dep removed |
107
-
| T8 |TODO| Update `torrust-tracker-metrics`: replace import of `DurationSinceUnixEpoch` from `torrust_tracker_primitives` with `torrust_tracker_clock`; remove `torrust-tracker-primitives` dep from its `Cargo.toml` if no longer needed |`cargo build -p torrust-tracker-metrics` succeeds; `cargo machete -p torrust-tracker-metrics` reports no unused deps |
100
+
| T1 |DONE| Define `DurationSinceUnixEpoch` in `packages/clock/src/lib.rs`|`pub type DurationSinceUnixEpoch = std::time::Duration;`|
101
+
| T2 |DONE| Update `packages/clock/src/clock/mod.rs` and `packages/clock/src/conv/mod.rs` to use the local definition | Replace `use torrust_tracker_primitives::DurationSinceUnixEpoch` with local import |
102
+
| T3 |DONE| Remove `torrust-tracker-primitives` dep from `packages/clock/Cargo.toml`| Dep entry removed; workspace build still passes |
103
+
| T4 |DONE| Update all 80+ workspace files to import `DurationSinceUnixEpoch` from `torrust_tracker_clock` instead of `torrust_tracker_primitives`| Use M1 grep to find the full file list; one-line change per file |
104
+
| T5 |DONE| Run `cargo build --workspace` and `cargo test --workspace`| Clean build and all tests pass |
105
+
| T6 |DONE| Run `linter all`| Exit code `0`|
106
+
| T7 |DONE| Update EPIC #1669 extraction ordering table: note that `torrust-tracker-clock` has no `torrust-tracker-primitives` dep |`torrust-tracker-clock` row: `torrust-tracker-primitives` dep removed |
107
+
| T8 |DONE| Update `torrust-tracker-metrics`: replace import of `DurationSinceUnixEpoch` from `torrust_tracker_primitives` with `torrust_tracker_clock`; remove `torrust-tracker-primitives` dep from its `Cargo.toml` if no longer needed |`cargo build -p torrust-tracker-metrics` succeeds; `cargo machete -p torrust-tracker-metrics` reports no unused deps |
108
108
109
109
## Progress Tracking
110
110
@@ -114,8 +114,8 @@ Status values: `TODO`, `IN_PROGRESS`, `BLOCKED`, `DONE`.
114
114
-[x] Spec reviewed and approved by user/maintainer
115
115
-[x] GitHub issue created and issue number added to this spec
116
116
-[x] Spec moved to `docs/issues/open/` with issue number prefix
117
-
-[] Implementation completed
118
-
-[] Automatic verification completed (`linter all`, `cargo test --workspace`)
117
+
-[x] Implementation completed
118
+
-[x] Automatic verification completed (`linter all`, `cargo test --workspace`)
119
119
-[ ] Manual verification scenarios executed and recorded
120
120
-[ ] Acceptance criteria reviewed after implementation and updated with evidence
121
121
-[ ] EPIC #1669 Active Subissues table updated to `DONE`
@@ -129,6 +129,10 @@ Status values: `TODO`, `IN_PROGRESS`, `BLOCKED`, `DONE`.
129
129
- 2026-05-18 00:00 UTC - josecelano - Spec updated to target current crate name
130
130
`torrust-tracker-clock` (Option A: proceed without SI-09 prerequisite). SI-09 prerequisite
131
131
removed; type will land as `torrust_tracker_clock::DurationSinceUnixEpoch`.
132
+
- 2026-05-18 18:30 UTC - josecelano - Implementation complete. All 77 workspace files
133
+
updated. `torrust-tracker-clock` no longer depends on `torrust-tracker-primitives`.
134
+
`torrust-tracker-metrics` now imports from `torrust-tracker-clock`.
135
+
`cargo build --workspace`, `cargo test --workspace`, and `linter all` all pass.
132
136
133
137
## Acceptance Criteria
134
138
@@ -157,8 +161,8 @@ Status values: `TODO`, `IN_PROGRESS`, `BLOCKED`, `DONE`.
157
161
158
162
Status values: `TODO`, `IN_PROGRESS`, `DONE`, `FAILED`, `BLOCKED`.
159
163
160
-
| ID | Scenario | Command / Steps | Expected Result | Status | Evidence |
| M1 | No workspace import from `torrust_tracker_primitives` for this type |`grep -r "torrust_tracker_primitives::DurationSinceUnixEpoch" . --include="*.rs"`| Zero matches |TODO||
163
-
| M2 |`torrust-tracker-clock` dep list is clean |`grep "torrust-tracker-primitives" packages/clock/Cargo.toml`| No output |TODO||
164
-
| M3 |`torrust-tracker-clock` exports `DurationSinceUnixEpoch`|`grep "DurationSinceUnixEpoch" packages/clock/src/lib.rs`|`pub type DurationSinceUnixEpoch` found |TODO||
164
+
| ID | Scenario | Command / Steps | Expected Result | Status | Evidence |
| M1 | No workspace import from `torrust_tracker_primitives` for this type |`grep -r "torrust_tracker_primitives::DurationSinceUnixEpoch" . --include="*.rs"`| Zero matches |DONE|Zero matches (only `primitives/` defines the type; no consumer imports it from there)|
167
+
| M2 |`torrust-tracker-clock` dep list is clean |`grep "torrust-tracker-primitives" packages/clock/Cargo.toml`| No output |DONE| No output confirmed |
168
+
| M3 |`torrust-tracker-clock` exports `DurationSinceUnixEpoch`|`grep "DurationSinceUnixEpoch" packages/clock/src/lib.rs`|`pub type DurationSinceUnixEpoch` found |DONE|`pub type DurationSinceUnixEpoch = std::time::Duration;` in `packages/clock/src/lib.rs`|
0 commit comments