File tree Expand file tree Collapse file tree 1 file changed +9
-11
lines changed Expand file tree Collapse file tree 1 file changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -43,38 +43,36 @@ pub struct Thinking;
43
43
///
44
44
/// This might not actually be true - the timebase of the return values from [`ndk::choreographer::ChoreographerFrameCallbackData`]
45
45
/// aren't documented by
46
- struct Timestamp ( u64 ) ;
46
+ struct Timestamp ( i64 ) ;
47
47
48
- impl Mul < u64 > for Timestamp {
48
+ impl Mul < i64 > for Timestamp {
49
49
type Output = Self ;
50
50
51
- fn mul ( self , rhs : u64 ) -> Self :: Output {
51
+ fn mul ( self , rhs : i64 ) -> Self :: Output {
52
52
Self ( self . 0 * rhs)
53
53
}
54
54
}
55
55
56
56
impl Timestamp {
57
- const fn from_nanos ( nanos : u64 ) -> Self {
57
+ const fn from_nanos ( nanos : i64 ) -> Self {
58
58
Self ( nanos)
59
59
}
60
60
61
- const fn from_micros ( micros : u64 ) -> Self {
61
+ const fn from_micros ( micros : i64 ) -> Self {
62
62
Self :: from_nanos ( micros * 1_000 )
63
63
}
64
64
65
- const fn from_millis ( millis : u64 ) -> Self {
65
+ const fn from_millis ( millis : i64 ) -> Self {
66
66
Self :: from_nanos ( millis * 1_000_000 )
67
67
}
68
68
69
69
/// Get the current time in `CLOCK_MONOTONIC`.
70
70
///
71
- /// TODO: This assumes that the value is less than ~2.5billion seconds (i.e. ~70 years)
71
+ /// TODO: This assumed the returned value is not negative.
72
+ /// Hopefully that's fine?
72
73
fn now ( ) -> Self {
73
74
let spec = nix:: time:: clock_gettime ( ClockId :: CLOCK_MONOTONIC ) . unwrap ( ) ;
74
- let stamp = ( spec. tv_sec ( ) * 1_000_000_000 + spec. tv_nsec ( ) )
75
- . try_into ( )
76
- . unwrap ( ) ;
77
- Self ( stamp)
75
+ Self ( spec. tv_sec ( ) * 1_000_000_000 + spec. tv_nsec ( ) )
78
76
}
79
77
}
80
78
You can’t perform that action at this time.
0 commit comments