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)
125125#endif
126126}
127127
128- static inline s64_t __ticks_to_ms (s64_t ticks )
128+ static inline u64_t __ticks_to_ms (s64_t ticks )
129129{
130130#ifdef CONFIG_SYS_CLOCK_EXISTS
131131
132132#ifdef _NEED_PRECISE_TICK_MS_CONVERSION
133133 /* 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 ;
135135#else
136136 /* 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 ;
140138#endif
141139
142140#else
143141 __ASSERT (ticks == 0 , "ticks not zero" );
144- return 0 ;
142+ return 0ULL ;
145143#endif
146144}
147145
You can’t perform that action at this time.
0 commit comments