/* Converts a SYSTEMTIME value to HAL time value  */
uint64_t HAL_Time_ConvertFromSystemTime(const SYSTEMTIME *systemTime)
/* Converts a SYSTEMTIME value to HAL time value  */
uint64_t HAL_Time_ConvertFromSystemTime(const SYSTEMTIME *systemTime)
{
    uint64_t r =
        YEARS_TO_DAYS(systemTime->wYear) + MONTH_TO_DAYS(systemTime->wYear, systemTime->wMonth) + systemTime->wDay - 1;
    r = (((((r * HOURS_TO_DAY) + systemTime->wHour) * MINUTES_TO_HOUR + systemTime->wMinute) * SECONDS_TO_MINUTES +
          systemTime->wSecond) *
             MILLISECONDS_TO_SECONDS +
         systemTime->wMilliseconds) *
        TIMEUNIT_TO_MILLISECONDS;
    return r;
}