[PATCH 1/4] jscript: Added implementation of Date constructor with more then one argument
Alexandre Julliard
julliard at winehq.org
Mon Jun 22 06:08:19 CDT 2009
Piotr Caban <piotr.caban at gmail.com> writes:
> @@ -221,6 +253,62 @@ static inline DOUBLE week_day(DOUBLE time)
> return ret;
> }
>
> +static inline DOUBLE convert_time(int year, SYSTEMTIME st)
> +{
> + DOUBLE time;
> + int set_week_day;
> +
> + time = time_from_year(year);
> + time += (DOUBLE)day_from_month(st.wMonth-1, in_leap_year(time)) * MS_PER_DAY;
> +
> + set_week_day = st.wDayOfWeek-week_day(time);
> + if(set_week_day < 0)
> + set_week_day += 7;
> + time += set_week_day * MS_PER_DAY;
> +
> + time += (DOUBLE)(st.wDay-1) * 7 * MS_PER_DAY;
> + if(month_from_time(time) != st.wMonth-1)
> + time -= 7 * MS_PER_DAY;
> +
> + time += st.wHour * MS_PER_HOUR;
> + time += st.wMinute * MS_PER_MINUTE;
> +
> + return time;
> +}
You should use SystemTimeToFileTime or some similar function, no need to
reinvent the wheel.
--
Alexandre Julliard
julliard at winehq.org
More information about the wine-devel
mailing list