jscript: Fix DateConstr_value (with one argument) implementation (3/9)

Alexandre Julliard julliard at winehq.org
Thu Jun 4 05:16:46 CDT 2009


Piotr Caban <piotr.caban at gmail.com> writes:

> +            FILETIME ft_now, ft_epoch;
> +            SYSTEMTIME st_epoch;
> +            DOUBLE time_now, time_epoch;
> +
> +            memset(&st_epoch, 0, sizeof(SYSTEMTIME));
> +            st_epoch.wYear = 1970;
> +            st_epoch.wMonth = 1;
> +            st_epoch.wDay = 1;
> +            SystemTimeToFileTime(&st_epoch, &ft_epoch);
> +
> +            GetSystemTimeAsFileTime(&ft_now);
>  
> -            GetSystemTimeAsFileTime(&time);
> +            time_now = (DOUBLE)ft_now.dwHighDateTime/10000*UINT_MAX
> +                + (DOUBLE)ft_now.dwLowDateTime/10000;
> +            time_epoch = (DOUBLE)ft_epoch.dwHighDateTime/10000*UINT_MAX
> +                + (DOUBLE)ft_epoch.dwLowDateTime/10000;

This is not correct, you need a <<32. Also there's no reason to use
doubles for the computation, and you shouldn't have to use
SystemTimeToFileTime for the epoch, it can be a constant.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list