forge
Explore
Log in

Don't you dare go Hollow

U13: remove Timestamp::checked_add_ticks and checked_diff; no caller in the workspace, edith or yumush

Browse files at this commit

eafd458fe5e249b521ff2cb357776d33880f1b89Ahmet Kaan GümüşParent: 3b414c5
crates/ec-core/src/timebase.rsmodified+0 -15
@@ -198,19 +198,6 @@ impl Timestamp {
198 .map(|t| Timestamp::new(t, base))198 .map(|t| Timestamp::new(t, base))
199 }199 }
200 200
201- /// Advance by `ticks` of this timestamp's own base.
202- pub fn checked_add_ticks(&self, ticks: i64) -> Option<Timestamp> {
203- self.ticks
204- .checked_add(ticks)
205- .map(|t| Timestamp::new(t, self.base))
206- }
207-
208- /// `self - other`, in this timestamp's base, exact.
209- pub fn checked_diff(&self, other: Timestamp) -> Option<i64> {
210- let o = other.checked_rescale(self.base, Rounding::Nearest)?;
211- self.ticks.checked_sub(o.ticks)
212- }
213-
214 /// Seconds as a float. Display only.201 /// Seconds as a float. Display only.
215 pub fn as_secs_f64(&self) -> f64 {202 pub fn as_secs_f64(&self) -> f64 {
216 self.ticks as f64 * self.base.as_secs_f64()203 self.ticks as f64 * self.base.as_secs_f64()
@@ -341,8 +328,6 @@ mod tests {
341 let a = Timestamp::new(90_000, TimeBase::MPEG_TS); // 1 s328 let a = Timestamp::new(90_000, TimeBase::MPEG_TS); // 1 s
342 let b = Timestamp::new(1_000, TimeBase::MILLIS); // 1 s329 let b = Timestamp::new(1_000, TimeBase::MILLIS); // 1 s
343 assert_eq!(a, b);330 assert_eq!(a, b);
344- assert_eq!(a.checked_diff(b), Some(0));
345- assert_eq!(a.checked_add_ticks(90_000).unwrap().ticks, 180_000);
346 assert_eq!(a.rescale(TimeBase::MILLIS, Rounding::Nearest).ticks, 1_000);331 assert_eq!(a.rescale(TimeBase::MILLIS, Rounding::Nearest).ticks, 1_000);
347 assert!(Timestamp::new(0, TimeBase::MILLIS) < a);332 assert!(Timestamp::new(0, TimeBase::MILLIS) < a);
348 }333 }