File tree Expand file tree Collapse file tree 2 files changed +26
-5
lines changed
store/re_log_types/src/index Expand file tree Collapse file tree 2 files changed +26
-5
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,6 @@ impl TimePoint {
52
52
}
53
53
}
54
54
55
- // #[deprecated] // TODO
56
55
#[ inline]
57
56
pub fn insert ( & mut self , timeline : Timeline , time : impl TryInto < TimeInt > ) {
58
57
let cell = IndexCell :: new (
@@ -73,7 +72,6 @@ impl TimePoint {
73
72
self
74
73
}
75
74
76
- // #[deprecated] // TODO
77
75
#[ must_use]
78
76
#[ inline]
79
77
pub fn with ( mut self , timeline : Timeline , time : impl TryInto < TimeInt > ) -> Self {
Original file line number Diff line number Diff line change @@ -2117,9 +2117,32 @@ impl RecordingStream {
2117
2117
/// - [`Self::disable_timeline`]
2118
2118
/// - [`Self::reset_time`]
2119
2119
pub fn set_time_seconds ( & self , timeline : impl Into < TimelineName > , seconds : impl Into < f64 > ) {
2120
- let seconds = seconds. into ( ) ;
2121
- // TODO: clamp with warning
2122
- self . set_time_nanos ( timeline, ( 1e9 * seconds) . round ( ) as i64 ) ;
2120
+ let f = move |inner : & RecordingStreamInner | {
2121
+ let mut seconds = seconds. into ( ) ;
2122
+ if seconds. is_nan ( ) {
2123
+ re_log:: error!( "set_time_seconds() called with NaN" ) ;
2124
+ seconds = 0.0 ;
2125
+ }
2126
+
2127
+ let nanos = 1e9 * seconds;
2128
+ let nanos_clamped = nanos. clamp ( NonMinI64 :: MIN . get ( ) as _ , NonMinI64 :: MAX . get ( ) as _ ) ;
2129
+
2130
+ if nanos != nanos_clamped {
2131
+ re_log:: warn_once!(
2132
+ "set_time_seconds() called with out-of-range value {seconds:?}. Clamping to valid range."
2133
+ ) ;
2134
+ }
2135
+
2136
+ ThreadInfo :: set_thread_time (
2137
+ & inner. info . store_id ,
2138
+ timeline. into ( ) ,
2139
+ IndexCell :: from_duration_nanos ( nanos_clamped. round ( ) as i64 ) ,
2140
+ ) ;
2141
+ } ;
2142
+
2143
+ if self . with ( f) . is_none ( ) {
2144
+ re_log:: warn_once!( "Recording disabled - call to set_time_seconds() ignored" ) ;
2145
+ }
2123
2146
}
2124
2147
2125
2148
/// Set the current time of the recording, for the current calling thread.
You can’t perform that action at this time.
0 commit comments