Forum Home
Press F1
 
Thread ID: 148142 2019-08-13 12:11:00 PC UpTime lastbootuptime GetTickCount() MistyCat (11583) Press F1
Post ID Timestamp Content User
1463066 2019-08-13 12:11:00 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
MistyCat (11583)
1463067 2019-08-13 13:10:00 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.

social.technet.microsoft.com
MistyCat (11583)
1463068 2019-08-13 21:36:00 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.
piroska (17583)
1