예제 #1
0
        static void deal(object sendeer, Alarmclock args)
        {
            //假定当前时间为12:00;
            int t = args.w - 12 * 60 * 60;

            Console.WriteLine("Alarm clock will alarm in " + t + " s");
            System.Threading.Thread.Sleep(t * 1000);
            Console.WriteLine("You need to get up");
        }
예제 #2
0
        public void get_time(int x, int y, int z)
        {
            Alarmclock nowtime = new Alarmclock()
            {
                h = x,
                m = y,
                s = z,
                w = x * 60 * 60 + y * 60 + z,
            };

            alarm(this, nowtime);
        }