Ejemplo n.º 1
0
        public static SDVTime operator -(SDVTime s1, SDVTime s2)
        {
            SDVTime ret = new SDVTime(s1);

            s1.hour   = s1.hour + s2.hour;
            s1.minute = s1.minute + s2.minute;

            while (s1.minute > 59)
            {
                s1.hour++;
                s1.minute -= MINPERHR;
            }

            while (s1.minute < 0)
            {
                s1.hour--;
                s1.minute += 60;
            }

            if (s1.hour >= MAXHOUR)
            {
                s1.hour = s1.hour - MAXHOUR;
            }
            return(ret);
        }
Ejemplo n.º 2
0
        public static SDVTime operator +(SDVTime s1, int time)
        {
            SDVTime ret = new SDVTime(s1);

            ret.AddTime(time);
            return(ret);
        }
Ejemplo n.º 3
0
        public static SDVTime operator -(SDVTime s1, SDVTime s2)
        {
            SDVTime ret = new SDVTime(s1);

            ret.hour   -= s2.hour;
            ret.minute -= s2.minute;

            while (ret.minute > (MINPERHR - 1))
            {
                ret.hour++;
                ret.minute -= MINPERHR;
            }

            while (ret.minute < 0)
            {
                ret.hour--;
                ret.minute += MINPERHR;
            }

            if (ret.hour >= MAXHOUR)
            {
                ret.hour -= MAXHOUR;
            }
            return(ret);
        }
Ejemplo n.º 4
0
        //operator functions
        public static SDVTime operator +(SDVTime s1, SDVTime s2)
        {
            SDVTime ret = new SDVTime(s1);

            ret.AddTime(s2);
            return(ret);
        }
Ejemplo n.º 5
0
        public static int AddTimeToIntTime(int s1, int s2)
        {
            SDVTime sTime = new SDVTime(s1);

            sTime.AddTime(s2);
            return(sTime.ReturnIntTime());
        }
Ejemplo n.º 6
0
        public override bool Equals(object obj)
        {
            SDVTime time = (SDVTime)obj;

            return(time != null &&
                   hour == time.hour &&
                   minute == time.minute);
        }
Ejemplo n.º 7
0
        public void AddTime(SDVTime sTime)
        {
            hour   = hour + sTime.hour;
            minute = minute + sTime.minute;

            while (minute > 59)
            {
                hour++;
                minute -= MINPERHR;
            }

            while (minute < 0)
            {
                hour--;
                minute += 60;
            }

            if (hour >= MAXHOUR)
            {
                hour = hour - MAXHOUR;
            }
        }
Ejemplo n.º 8
0
        public void AddTime(SDVTime sTime)
        {
            hour   += sTime.hour;
            minute += sTime.minute;

            while (minute > (MINPERHR - 1))
            {
                hour++;
                minute -= MINPERHR;
            }

            while (minute < 0)
            {
                hour--;
                minute += MAXHOUR;
            }

            if (hour >= MAXHOUR)
            {
                hour -= MAXHOUR;
            }
        }
Ejemplo n.º 9
0
 public bool Equals(SDVTime other)
 {
     return(other != null &&
            hour == other.hour &&
            minute == other.minute);
 }
Ejemplo n.º 10
0
 public SDVTime(SDVTime c)
 {
     hour   = c.hour;
     minute = c.minute;
 }
Ejemplo n.º 11
0
 /// <summary>
 /// This function takes two integer times and returns minutes between. Note: this returns an absolute value.
 /// </summary>
 /// <param name="t1">The first int time.</param>
 /// <param name="t2">The second int time</param>
 /// <returns>Amount of minutes between the two times</returns>
 public static int MinutesBetweenTwoIntTimes(int t1, int t2)
 {
     return(Math.Abs(SDVTime.ConvertIntTimeToMinutes(t1) - SDVTime.ConvertIntTimeToMinutes(t2)));
 }