Fixed issue with integer overflow when converting time units

pull/11894/head
Ryan Morse 2019-10-10 10:28:34 -07:00 committed by adbridge
parent 154d51b040
commit 2d757fc321
2 changed files with 3 additions and 2 deletions

View File

@ -167,7 +167,8 @@ extern cy_rtos_error_t cy_rtos_last_error();
* @param[in] entry_function Function pointer which points to the main function for the new thread
* @param[in] name String thread name used for a debugger
* @param[in] stack The buffer to use for the thread stack. This must be aligned to
CY_RTOS_ALIGNMENT with a size of at least CY_RTOS_MIN_STACK_SIZE
* CY_RTOS_ALIGNMENT with a size of at least CY_RTOS_MIN_STACK_SIZE.
* If stack is null, cy_rtos_create_thread will allocate a stack from the heap.
* @param[in] stack_size The size of the thread stack in bytes
* @param[in] priority The priority of the thread. Values are operating system specific, but some
* common priority levels are defined:

View File

@ -803,7 +803,7 @@ cy_rslt_t cy_rtos_get_time(cy_time_t *tval)
/* Convert ticks count to time in milliseconds */
if (tick_freq != 0)
*tval = ((osKernelGetTickCount() * 1000) / tick_freq);
*tval = (cy_time_t)((osKernelGetTickCount() * 1000LL) / tick_freq);
else
status = CY_RTOS_GENERAL_ERROR;
}