Esempio n. 1
0
        public SleepCommand(long milliseconds, ActiveObjectEngine engine, Command wakeupCommand)

        {
            this.engine = engine;
            sleepTime   = milliseconds;
            subCommand  = wakeupCommand;
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Command wakeup       = new WakeUpCommand();
            var     e            = new ActiveObjectEngine();
            Command sleepCommand = new SleepCommand(1000, e, wakeup);

            e.addCommand(sleepCommand);
            long start = DateTime.Now.Second;

            e.run();
            long end       = DateTime.Now.Second;
            long sleepTime = end - start;

            Console.WriteLine($"SleepTime is {sleepTime}");
        }