File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -125,23 +125,21 @@ static ALWAYS_INLINE s32_t _ms_to_ticks(s32_t ms)
125
125
#endif
126
126
}
127
127
128
- static inline s64_t __ticks_to_ms (s64_t ticks )
128
+ static inline u64_t __ticks_to_ms (s64_t ticks )
129
129
{
130
130
#ifdef CONFIG_SYS_CLOCK_EXISTS
131
131
132
132
#ifdef _NEED_PRECISE_TICK_MS_CONVERSION
133
133
/* use 64-bit math to keep precision */
134
- return (u64_t )ticks * MSEC_PER_SEC / CONFIG_SYS_CLOCK_TICKS_PER_SEC ;
134
+ return (u64_t )ticks * MSEC_PER_SEC / ( u64_t ) CONFIG_SYS_CLOCK_TICKS_PER_SEC ;
135
135
#else
136
136
/* simple multiplication keeps precision */
137
- u32_t ms_per_tick = MSEC_PER_SEC / CONFIG_SYS_CLOCK_TICKS_PER_SEC ;
138
-
139
- return (u64_t )ticks * ms_per_tick ;
137
+ return (u64_t )ticks * MSEC_PER_SEC / (u64_t )CONFIG_SYS_CLOCK_TICKS_PER_SEC ;
140
138
#endif
141
139
142
140
#else
143
141
__ASSERT (ticks == 0 , "ticks not zero" );
144
- return 0 ;
142
+ return 0ULL ;
145
143
#endif
146
144
}
147
145
You can’t perform that action at this time.
0 commit comments