Esempio n. 1
0
        //--------------------------------------------------------------------
        // Purpose:
        //     Test the StopWatch
        //
        // Notes:
        //
        //--------------------------------------------------------------------
        static void Main(string[] args)
        {
            StopWatch fiveSeconds = new StopWatch(5 * StopWatch.ONE_SECOND);

            Console.WriteLine("Waiting five seconds");
            fiveSeconds.Reset();
            while (false == fiveSeconds.IsExpired())
            {
                // Do Nothing
            }
            Console.WriteLine("Done");
            Console.WriteLine("Now:" + StopWatch.Now().ToString());
            Thread.Sleep(1234);
            Console.WriteLine("Now:" + fiveSeconds.GetTimeLeft().ToString());
        }