Results 1 to 3 of 3
  1. #1
    Junior Member
    Join Date
    Jan 2005
    Location
    Christchurch
    Posts
    91

    Default PC UpTime lastbootuptime GetTickCount()

    For years I've been using this VBA 6.5 code (behind Access) to check if it's time to reboot.

    Function UpTime()
    Dim Days#
    Dim DayShow$
    Days = (GetTickCount() / 1000 / (60# * 60# * 24#)) + 1
    If DatePart("y", Days) = 365 Then
    DayShow = "0 Days "
    Else
    DayShow = CStr(DatePart("y", Days)) & " Days "
    End If
    UpTime = DayShow & Format(Days, "hh:nn:ss")
    Debug.Print UpTime
    'MsgBox UpTime
    End Function

    It's always worked.

    Today it told me:
    350 Days 17:37:21

    So, I tried a few other things (after re-booting about half an hour ago.)
    Many things tell me I've been running since about 10pm 10/07/2019

    wmic os get lastbootuptime
    LastBootUpTime
    20190710224154.504864+720

    C:\Users\Alan>systeminfo | find /i "Boot Time"
    System Boot Time: 10/07/2019, 10:41:54 PM

    Task Manager – Performance:
    System Boot Time: 10/07/2019, 10:41:54 PM

    ?GetTickCount
    -1356479203



    I'm running Windows 10 ver 1809 build 17763.651, I'm relatively sober and I can usually work out what's going on, but right now I'm beaten.

    Does any Windows 10 user NOT get a believable result on typing...
    systeminfo | find /i "Boot Time"
    ... into a cmd window?

    Anyone know what blindingly obvious thing I've changed/overlooked/forgotten?

    PS just tried this:

    C:\WINDOWS\system32>net statistics workstation
    Workstation Statistics for \\ALAN


    Statistics since 10/07/2019 10:42:18 PM

    In about a quarter hour of checking things, I've gained 24 seconds. I'm kinda puzzled.

    Alan

    PS Yes, my system clock is correct, showing 13th August 2019 11.17pm
    Last edited by MistyCat; 13-08-2019 at 11:17 PM.

  2. #2
    Junior Member
    Join Date
    Jan 2005
    Location
    Christchurch
    Posts
    91

    Default Re: PC UpTime lastbootuptime GetTickCount()

    I have my answer. It's my habit to either Sleep or Shut Down. I very seldom Restart. Apparently, not for 34 days this time.
    I've just looked through my code repository to find that I've been successfully using that VBA GetTickCount code in Access since 1996, and this is the first time I've noticed a weird result.
    Just how long do some bugs lurk before they bite you in the bum? (Rhetorical)
    Actually, I think that's new to Windows 10. Don't know, don't care any more. Goodnight.

    https://social.technet.microsoft.com...10itprogeneral

  3. #3
    Senior Member piroska's Avatar
    Join Date
    Dec 2017
    Posts
    1,529

    Default Re: PC UpTime lastbootuptime GetTickCount()

    Bit of a waste of power.
    I have always shut down my PC at end of day. It's not a server so has no need to be on.

    And uses less power, sleep, standbys, they all still use power. I do it with no device except my printer.
    Ex-pctek

Similar Threads

  1. Post Your Uptime!
    By Cato in forum PC World Chat
    Replies: 36
    Last Post: 26-05-2011, 07:42 AM
  2. Windows Uptime?
    By pluto in forum PressF1
    Replies: 10
    Last Post: 26-03-2003, 05:03 PM
  3. Monitor Jetstream uptime
    By in forum PressF1
    Replies: 0
    Last Post: 11-10-2001, 11:25 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •