DateAndTime.Timer Propriedade

Definição

Retorna um valor Double que representa o número de segundos decorridos desde a meia-noite.Returns a Double value representing the number of seconds elapsed since midnight.

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

Valor da propriedade

Double

Um valor que representa o número de segundos decorridos desde a meia-noite.A value representing the number of seconds elapsed since midnight.

Exemplos

Este exemplo usa a Timer propriedade para pausar o aplicativo.This example uses the Timer property to pause the application. Ele pode executar outro processamento durante a pausa.It can perform other processing during the pause.

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

Observe que você deve qualificar a Timer propriedade com o Microsoft.VisualBasic namespace, porque Timer também é uma classe definida nos System.Threading System.Timers System.Windows.Forms namespaces, e.Note that you must qualify the Timer property with the Microsoft.VisualBasic namespace, because Timer is also a defined class in the System.Threading, System.Timers, and System.Windows.Forms namespaces.

Comentários

A Timer propriedade retorna os segundos e os milissegundos desde a meia-noite mais recente.The Timer property returns both the seconds and the milliseconds since the most recent midnight. Os segundos estão na parte integral do valor de retorno e os milissegundos estão na parte fracionária.The seconds are in the integral part of the return value, and the milliseconds are in the fractional part.

Aplica-se a

Confira também