[PATCH 1/4] jscript: Added implementation of Date constructor with more then one argument

Piotr Caban piotr.caban at gmail.com
Mon Jun 22 06:16:35 CDT 2009


Alexandre Julliard wrote:
> 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.
> 

In this case SYSTEMTIME keeps information returned by
GetTimeZoneInformation. It's used to store informations about
daylight/standard time adjustment. Because there's no ordinary date
SystemTimeToFileTime can't be used.



More information about the wine-devel mailing list