Example #1
0
        private MyTime AddOneHour()
        {
            if (GetHour() == 24)
            {
                SetHour(0);
                SetMin(0);
            }
            MyTime time = new MyTime(hour, minute, second);

            return(time);
        }
Example #2
0
        private MyTime AddOneSecond()
        {
            if (GetSecond() == 59)
            {
                SetMin(GetMin() + 1);
                SetSecond(0);
            }
            MyTime time = new MyTime(hour, minute, second);

            return(time);
        }
Example #3
0
        private static MyTime TimeSinceMidnight()
        {
            int secPerDay = 60 * 60 * 24;
            int mysec;

            mysec = ((sec % secPerDay) + secPerDay) % secPerDay;
            int    h      = mysec / 3600;
            int    m      = (mysec / 60) % 60;
            int    s      = mysec % 60;
            MyTime mytime = new MyTime(h, m, s);

            return(mytime);
        }
Example #4
0
        static void Main()
        {
            Console.WriteLine("Введіть години");
            int hours = int.Parse(Console.ReadLine());

            Console.WriteLine("Введіть хвилини");
            int minutes = int.Parse(Console.ReadLine());

            Console.WriteLine("Введіть секунди");
            int    seconds = int.Parse(Console.ReadLine());
            MyTime time    = new MyTime(hours, minutes, seconds);

            time.Timer();
        }