zerodds-time-service
Layer 1 — Primitives. OMG Time Service 1.1 — TimeBase / UTO / TIO / TimeService.
- Source: crates/time-service
- API docs: docs.rs/zerodds-time-service
zerodds-time-service implements the normative data types and operations of the OMG Time Service spec 1.1 (formal/2002-05-07) as a pure-Rust no_std library. Standalone — not used internally by ZeroDDS DCPS (DDS-DCPS has its own spec-mandated Time_t).
Spec anchors
- OMG Time Service 1.1 §1.3.2 (TimeBase: TimeT/InaccuracyT/TdfT/UtcT/IntervalT)
- OMG Time Service 1.1 §1.3.3 (TimeUnavailable exception)
- OMG Time Service 1.1 §1.3.4 (UTO — Universal Time Object)
- OMG Time Service 1.1 §1.3.5 (TIO — Time Interval Object)
- OMG Time Service 1.1 §2.1 (TimeService interface)
Out of scope: §2.2 + §2.4 TimerEventService — requires a CORBA event-channel ORB; addressed in corba-ccm.
Relationship to DDS-DCPS Time_t
OMG Time Service 1.1 and DDS-DCPS 1.4 §2.3.3 are spec-distinct:
| Aspect | OMG Time Service 1.1 | DDS-DCPS 1.4 |
|---|---|---|
| Wire format | UtcT 16 byte |
Time_t 8 byte |
| Epoch | 15 October 1582 | 1 January 1970 (UNIX) |
| Resolution | 100ns ticks | 1ns (sec + nanosec) |
| Inaccuracy / TDF | yes | no |
ZeroDDS DCPS uses exclusively the spec-mandated Time_t format. zerodds-time-service is a separate public API for applications that need OMG Time Service conformance.
Public API (selection)
TimeBase: TimeT, InaccuracyT, TdfT, UtcT, IntervalT, current_time(), UTC_EPOCH_TO_UNIX_TICKS, TICKS_PER_SECOND.
UTO: Uto with absolute_time / compare_time / time_to_interval / interval; ComparisonType::{IntervalC, MidC}; TimeComparison::{EqualTo, LessThan, GreaterThan, Indeterminate}.
TIO: Tio with time_interval / overlaps / contains / spans; OverlapType.
Service: TimeService with universal_time / secure_universal_time / new_universal_time / uto_from_utc / new_interval; TimeUnavailable.
Quick start
use zerodds_time_service::{TimeService, Uto, ComparisonType, TimeComparison};
let service = TimeService::default();
let now = service.universal_time().unwrap();
let later = Uto::new(now.time() + 1_000_000, 50, 0);
let cmp = now.compare_time(ComparisonType::IntervalC, later);
assert_ne!(cmp, TimeComparison::GreaterThan);
Feature flags
| Feature | Default | Purpose |
|---|---|---|
std |
✅ | current_time() via SystemTime; std re-exports |
alloc |
✅ | mandatory (Vec/wire buffer) |
no_std build without std: current_time() returns 0; a real time source must be injected by the embedding via TimeService::with_source(...) (Phase 2).
Tests
cargo test -p zerodds-time-service: 36 tests (35 unit + 1 doctest).
Stability
All public-API items are semver-stable from 1.0.0-rc.3.
zerodds-time-service
Layer 1 — Primitives. OMG Time Service 1.1 — TimeBase / UTO / TIO / TimeService.
- Quelle: crates/time-service
- API-Docs: docs.rs/zerodds-time-service
zerodds-time-service implementiert die normativen Datentypen und Operationen der OMG Time Service Spec 1.1 (formal/2002-05-07) als Pure-Rust no_std-Library. Standalone — wird von ZeroDDS-DCPS intern nicht verwendet (DDS-DCPS hat sein eigenes spec-mandate Time_t).
Spec-Anker
- OMG Time Service 1.1 §1.3.2 (TimeBase: TimeT/InaccuracyT/TdfT/UtcT/IntervalT)
- OMG Time Service 1.1 §1.3.3 (TimeUnavailable Exception)
- OMG Time Service 1.1 §1.3.4 (UTO — Universal Time Object)
- OMG Time Service 1.1 §1.3.5 (TIO — Time Interval Object)
- OMG Time Service 1.1 §2.1 (TimeService Interface)
Out-of-Scope: §2.2 + §2.4 TimerEventService — verlangt CORBA-Event-Channel-ORB; in corba-ccm adressiert.
Verhältnis zu DDS-DCPS Time_t
OMG Time Service 1.1 und DDS-DCPS 1.4 §2.3.3 sind spec-distinkt:
| Aspekt | OMG Time Service 1.1 | DDS-DCPS 1.4 |
|---|---|---|
| Wire-Format | UtcT 16 byte |
Time_t 8 byte |
| Epoch | 15 October 1582 | 1 January 1970 (UNIX) |
| Auflösung | 100ns Ticks | 1ns (sec + nanosec) |
| Inaccuracy / TDF | ja | nein |
ZeroDDS-DCPS verwendet ausschließlich das spec-mandate Time_t-Format. zerodds-time-service ist eine eigene Public-API für Anwendungen mit OMG-Time-Service-Konformitätsbedarf.
Public API (Auswahl)
TimeBase: TimeT, InaccuracyT, TdfT, UtcT, IntervalT, current_time(), UTC_EPOCH_TO_UNIX_TICKS, TICKS_PER_SECOND.
UTO: Uto mit absolute_time / compare_time / time_to_interval / interval; ComparisonType::{IntervalC, MidC}; TimeComparison::{EqualTo, LessThan, GreaterThan, Indeterminate}.
TIO: Tio mit time_interval / overlaps / contains / spans; OverlapType.
Service: TimeService mit universal_time / secure_universal_time / new_universal_time / uto_from_utc / new_interval; TimeUnavailable.
Quick Start
use zerodds_time_service::{TimeService, Uto, ComparisonType, TimeComparison};
let service = TimeService::default();
let now = service.universal_time().unwrap();
let later = Uto::new(now.time() + 1_000_000, 50, 0);
let cmp = now.compare_time(ComparisonType::IntervalC, later);
assert_ne!(cmp, TimeComparison::GreaterThan);
Feature-Flags
| Feature | Default | Zweck |
|---|---|---|
std |
✅ | current_time() via SystemTime; std-Re-Exports |
alloc |
✅ | mandatory (Vec/wire-buffer) |
no_std-Build ohne std: current_time() liefert 0; eine echte Zeitquelle muss vom Embedding via TimeService::with_source(...) injiziert werden (Phase-2).
Tests
cargo test -p zerodds-time-service: 36 Tests (35 unit + 1 doctest).
Stability
Alle Public-API-Items sind ab 1.0.0-rc.3 semver-stabil.