DateAndTime.Timer 속성

정의

Double 자정 이후 경과된 시간(초)을 나타내는 값을 반환합니다.

public:
 static property double Timer { double get(); };
public static double Timer { get; }
static member Timer : double
Public ReadOnly Property Timer As Double

속성 값

자정 이후 경과된 시간(초)을 나타내는 값입니다.

예제

이 예제에서는 Timer 속성을 사용하여 애플리케이션을 일시 중지합니다. 일시 중지하는 동안 다른 처리를 수행할 수 있습니다.

Public Sub waitFiveSeconds()
    If TimeOfDay >= #11:59:55 PM# Then
        MsgBox("The current time is within 5 seconds of midnight" &
            vbCrLf & "The timer returns to 0.0 at midnight")
        Return
    End If
    Dim start, finish, totalTime As Double
    If (MsgBox("Press Yes to pause for 5 seconds", MsgBoxStyle.YesNo)) =
         MsgBoxResult.Yes Then

        start = Microsoft.VisualBasic.DateAndTime.Timer
        ' Set end time for 5-second duration.
        finish = start + 5.0
        Do While Microsoft.VisualBasic.DateAndTime.Timer < finish
            ' Do other processing while waiting for 5 seconds to elapse.
        Loop
        totalTime = Microsoft.VisualBasic.DateAndTime.Timer - start
        MsgBox("Paused for " & totalTime & " seconds")
    End If
End Sub

TimerSystem.Threading, System.TimersSystem.Windows.Forms 네임스페이스의 정의된 클래스이기 때문에 Timer 속성을 Microsoft.VisualBasic 네임스페이스로 한정해야 합니다.

설명

이 속성은 Timer 가장 최근 자정 이후의 초 및 밀리초를 모두 반환합니다. 초는 반환 값의 정수 부분에 있고 밀리초는 소수 부분에 있습니다.

적용 대상

추가 정보