예제 #1
0
 public void start()
 {
     while (a.isStop == false)
     {
         Thread.Sleep(10);
         if (a.GetHours() > 0)
         {
             setText_Control(Lab_hour, a.GetHours().ToString("00"));
             setText_Control(label4, ":");
         }
         setText_Control(Lab_minute, a.GetMinutes().ToString("00"));
         setText_Control(Lab_sec, a.GetSeconds().ToString("00"));
         setText_Control(Lab_milisec, a.GetMiliseconds().ToString("00"));
         a.IncreaseMilisec();
         if (a.Record_Count > 0)
         {
             if (a.GetHours2() > 0)
             {
                 setText_Control(Lab_hour2, a.GetHours2().ToString("00"));
                 setText_Control(label1, ":");
             }
             ;
             setText_Control(Lab_minute2, a.GetMinutes2().ToString("00"));
             setText_Control(label2, ":");
             setText_Control(Lab_sec2, a.GetSeconds2().ToString("00"));
             setText_Control(label3, ".");
             setText_Control(Lab_milisec2, a.GetMiliseconds2().ToString("00"));
         }
         a.IncreaseMilisec2();
     }
 }
예제 #2
0
        public void StopWatch()
        {
            StopWatch stopwatch = new StopWatch();

            stopwatch.Start();
            TemporalHelpers.PauseExecution(2000);
            stopwatch.Stop();

            Assert.AreEqual(2, stopwatch.GetSeconds <int>(), "GetSeconds()");

            stopwatch.StopDate = stopwatch.StartDate.AddSeconds(1);
            Assert.AreEqual("00:00:01", stopwatch.GetTimeSpan().ToString(@"hh\:mm\:ss"), "GetTimeSpan() 1 second");

            stopwatch.StopDate = stopwatch.StartDate.AddDays(1);
            Assert.AreEqual("1.00:00:00", stopwatch.GetTimeSpan().ToString(@"d\.hh\:mm\:ss"), "GetTimeSpan() 1 day");

            stopwatch.StopDate = stopwatch.StartDate.AddDays(3).AddHours(5).AddMinutes(7).AddSeconds(15);
            Assert.AreEqual("3.05:07:15", stopwatch.GetTimeSpan().ToString(@"d\.hh\:mm\:ss"), "GetTimeSpan() complex");

            stopwatch.StopDate = stopwatch.StartDate.AddDays(3).AddHours(5).AddMinutes(7).AddSeconds(15).AddMilliseconds(999);
            Assert.AreEqual("3.05:07:15.999", stopwatch.GetTimeSpan().ToString(@"d\.hh\:mm\:ss\.fff"), "GetTimeSpan() complex 2");
        }