[PATCH 7/7] ucrtbase: Correct behavior of strftime format %c.

Piotr Caban piotr.caban at gmail.com
Fri Nov 22 06:50:57 CST 2019


Hi Jeff,

On 11/22/19 1:28 AM, Jeff Smith wrote:
> +    BOOL time_data_from_param = (time_data) ? TRUE : FALSE;
time_data_from_param is not used if MSVCR_VER != 140. Also a quick 
testing shows that it's still not correct. Probably we should find a 
better way of recognizing lc_time_curr from C locale.

> +#if _MSVCR_VER>=140
> +            if(!strcmp(locinfo->lc_category[MSVCRT_LC_TIME].locale, "C") &&
> +                    !time_data_from_param && !alternate)
> +            {
> +                static const WCHAR date_format[] = { 'd','d','d',' ','M','M','M',' ','d','d',
> +                            ' ','H','H',':','m','m',':','s','s',' ','y','y','y','y',0 };
> +                MSVCRT_size_t day_offset = ret + 8;
> +                if(!strftime_format(str, &ret, max, mstm, time_data, date_format))
> +                    return 0;
> +                if(str[day_offset] == '0')
> +                    str[day_offset] = ' ';
Is it the same as calling following code?
static const WCHAR date_format[] = {'a',' ','b',' ','e',' ','T',' ','Y'};
tmp = strftime_impl(str+ret, max-ret, date_format, mstm, time_data, loc);
if (!tmp) goto einval_error;
ret += tmp;

It will remove the need to manipulate the function output.

Thanks,
Piotr



More information about the wine-devel mailing list