public static double setSeconds(object thisObj, double dsec, object msec) { SemanticAnalyser.assert_type(thisObj, typeof(DateObject)); DateObject date = (DateObject)thisObj; double t = DateConstructor.LocalTime(date.ms); double new_ms; if (msec == null) { new_ms = DateConstructor.msFromTime(t); } else { new_ms = Convert.ToNumber(msec); } double time = DateConstructor.MakeTime(DateConstructor.HourFromTime(t), DateConstructor.MinFromTime(t), dsec, new_ms); double day = Math.Floor(t / DateConstructor.MS_PER_DAY); double new_val = DateConstructor.ToUTC(DateConstructor.MakeDate(day, time)); date.ms = DateConstructor.TimeClip(new_val); return(date.ms); }
public static double setMonth(object thisObj, double dmonth, object date) { SemanticAnalyser.assert_type(thisObj, typeof(DateObject)); DateObject dt = (DateObject)thisObj; double t = DateConstructor.LocalTime(dt.ms); double new_date; if (date == null) { new_date = DateConstructor.DateFromTime(t); } else { new_date = Convert.ToNumber(date); } double day = DateConstructor.MakeDay((double)DateConstructor.YearFromTime(t), dmonth, new_date); double new_val = DateConstructor.ToUTC(DateConstructor.MakeDate(day, t % DateConstructor.MS_PER_DAY)); dt.ms = DateConstructor.TimeClip(new_val); return(dt.ms); }
public static double setDate(object thisObj, double ddate) { SemanticAnalyser.assert_type(thisObj, typeof(DateObject)); DateObject date = (DateObject)thisObj; double t = DateConstructor.LocalTime(date.ms); double day = DateConstructor.MakeDay((double)DateConstructor.YearFromTime(t), (double)DateConstructor.MonthFromTime(t), ddate); double new_val = DateConstructor.ToUTC(DateConstructor.MakeDate(day, t % DateConstructor.MS_PER_DAY)); date.ms = DateConstructor.TimeClip(new_val); return(date.ms); }
public static double setMilliseconds(object thisObj, double dmsec) { SemanticAnalyser.assert_type(thisObj, typeof(DateObject)); DateObject date = (DateObject)thisObj; double t = DateConstructor.LocalTime(date.ms); double time = DateConstructor.MakeTime(DateConstructor.HourFromTime(t), DateConstructor.MinFromTime(t), DateConstructor.SecFromTime(t), dmsec); double day = Math.Floor(t / DateConstructor.MS_PER_DAY); double new_val = DateConstructor.ToUTC(DateConstructor.MakeDate(day, time)); date.ms = DateConstructor.TimeClip(new_val); return(date.ms); }
public static double setFullYear(object thisObj, double dyear, object month, object date) { SemanticAnalyser.assert_type(thisObj, typeof(DateObject)); DateObject dt = (DateObject)thisObj; double t = DateConstructor.LocalTime(dt.ms); if (Double.IsNaN(t)) { t = 0; } double new_month; if (month == null) { new_month = DateConstructor.MonthFromTime(t); } else { new_month = Convert.ToNumber(month); } double new_date; if (date == null) { new_date = DateConstructor.DateFromTime(t); } else { new_date = Convert.ToNumber(date); } double day = DateConstructor.MakeDay(dyear, new_month, new_date); double new_val = DateConstructor.ToUTC(DateConstructor.MakeDate(day, t % DateConstructor.MS_PER_DAY)); dt.ms = DateConstructor.TimeClip(new_val); return(dt.ms); }