コード例 #1
0
        public static double setUTCSeconds(object thisObj, double dsec, object msec)
        {
            SemanticAnalyser.assert_type(thisObj, typeof(DateObject));
            DateObject date = (DateObject)thisObj;
            double     t    = 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.MakeDate(day, time);

            date.ms = DateConstructor.TimeClip(new_val);
            return(date.ms);
        }
コード例 #2
0
        public static double setUTCMilliseconds(object thisObj, double msec)
        {
            SemanticAnalyser.assert_type(thisObj, typeof(DateObject));
            DateObject date = (DateObject)thisObj;
            double     t    = date.ms;
            double     time = DateConstructor.MakeTime(DateConstructor.HourFromTime(t), DateConstructor.MinFromTime(t),
                                                       DateConstructor.SecFromTime(t), msec);
            double day     = Math.Floor(t / DateConstructor.MS_PER_DAY);
            double new_val = DateConstructor.MakeDate(day, time);

            date.ms = DateConstructor.TimeClip(new_val);
            return(date.ms);
        }
コード例 #3
0
        public static double setHours(object thisObj, double dhour, object min,
                                      object sec, object msec)
        {
            SemanticAnalyser.assert_type(thisObj, typeof(DateObject));
            DateObject date = (DateObject)thisObj;
            double     t    = DateConstructor.LocalTime(date.ms);

            double new_min;

            if (min == null)
            {
                new_min = DateConstructor.MinFromTime(t);
            }
            else
            {
                new_min = Convert.ToNumber(min);
            }

            double new_sec;

            if (sec == null)
            {
                new_sec = DateConstructor.SecFromTime(t);
            }
            else
            {
                new_sec = Convert.ToNumber(sec);
            }

            double new_ms;

            if (msec == null)
            {
                new_ms = DateConstructor.msFromTime(t);
            }
            else
            {
                new_ms = Convert.ToNumber(msec);
            }

            double time    = DateConstructor.MakeTime(dhour, new_min, new_sec, 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);
        }