While looking for an OLE Automation solution to the "Inactivity Event or
Screensaver Event" thread I created a VB.Net version of Windows Up Time.


Run it to display the days, hours, minutes, seconds the server or
computer was last booted.  The output can be captured by $PROCESS $ in a
filter or active link.  It could be useful for a Remedy Administrator to
see how long the server has been up.


Module Module1

    Private Declare Function GetTickCount Lib "kernel32" () As Integer

    Sub Main()
        Try
            Dim Days As Integer = 0
            Dim Hours As Integer = 0
            Dim Minutes As Integer = 0
            Dim Seconds As Integer = GetTickCount() / 1000

            If Seconds > 0 Then
                Days = Math.Floor(Seconds / 86400)
                If Days > 0 Then Seconds -= (Days * 86400)
            End If

            If Seconds > 0 Then
                Hours = Math.Floor(Seconds / 3600)
                If  Hours > 0 Then Seconds -= (Hours * 3600)
            End If

            If Seconds > 0 Then
                Minutes = Math.Floor(Seconds / 60)
                If Minutes > 0 Then Seconds -= (Minutes * 60)
            End If

            Console.WriteLine(Days.ToString & " days, " & Hours.ToString
& " hours, " & Minutes.ToString & " minutes, " & Seconds.ToString & "
seconds")

        Catch ex As Exception
            Console.WriteLine(ex.Message)
        End Try
        End
    End Sub


 
 
Stephen 

_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at http://www.wwrug.org

Reply via email to