Adblock breaks this site

System Uptime

Discussion in 'Archives' started by Arkane, Jul 12, 2007.

  1. Arkane

    Arkane Guest

    Referrals:
    0
    System Uptime

    Get the current System Uptime and convert to days/hours/minutes/seconds/miliseconds, place in a module to use.

    Code:
    '---In Module---'
    Public Type TimeConv
        Days        As Long
        Hours       As Long
        Minutes     As Long
        Seconds     As Long
        MSeconds    As Long
    End Type
     
    Private Declare Function GetTickCount Lib "kernel32.dll" () As Long
     
    Private Function ConvertTime(ByVal Tick As Long) As TimeConv
     
    ConvertTime.MSeconds = Tick Mod 1000
     
    Tick = Tick \ 1000
    ConvertTime.Days = ((Tick) \ (24 * (60 ^ 2)))
     
    If ConvertTime.Days > 0 Then Tick = (Tick - 24 * (60 ^ 2)) * ConvertTime.Days
    ConvertTime.Hours = Tick \ (60 ^ 2)
     
    If ConvertTime.Hours > 0 Then Tick = Tick - ((60 ^ 2) * ConvertTime.Hours)
    ConvertTime.Minutes = Tick \ 60
     
    ConvertTime.Seconds = Tick Mod 60
     
    End Function
     
     
    Property Get SystemUptime() As TimeConv
    SystemUptime = ConvertTime(GetTickCount)
    End Property
     
     
    '---Form Usage Example:---'
    Private Sub Timer1_Timer()
    Label1 = "System Uptime: " & SystemUptime.Days & " Days, " & _
            SystemUptime.Hours & " Hours, " & _
            SystemUptime.Minutes & " Mins, " & _
            SystemUptime.Seconds & " Seconds, " & _
            SystemUptime.MSeconds & " Miliseconds"
    End Sub
    Feedback is welcomed, suggestions are also welcomed.
     
  2. Jazz00006

    Jazz00006 Apprentice
    Visual Basic Programmers

    Joined:
    Aug 26, 2005
    Posts:
    807
    Referrals:
    0
    Sythe Gold:
    0
    System Uptime

< sellin amazing pure str!!!!!! | Selling 150m ~NO Paypal~ >


 
 
Adblock breaks this site