Yes I know we shouldn't be using gadgets, but I simply don't care.
I've been using Computer Status (Computer Status Gadget v3.5 by ~drakesteele on deviantART
) for the longest time, and all versions have this annoying bug where the uptime part doesn't work, where immediately after booting up it says -68 (negative) days or so and counts down from that day. It seems to work fine on other people's computers, but it doesn't work on my desktop or laptop. I've tried running sidebar in 32 bit mode and installing the latest version of .NET, and nothing seems to help. I'm assuming that I don't have something installed that the gadget relies on.
This is the code itself that I'm assuming the problem is in:
UpdateInterval = 1
System.Gadget.Settings.write "UpdateInterval", UpdateInterval
GetUpdateInterval = UpdateInterval * 1000
Set objLocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = objLocator.ConnectServer(MachineName, "root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
For Each objOS in colOperatingSystems
dtmBootup = objOS.LastBootUpTime
dtmLastBootupTime = WMIDateStringToDate(dtmBootup)
dtmSystemUptimeSecs = DateDiff("s", dtmLastBootUpTime, Now)
intSecsTotal = dtmSystemUptimeSecs
intDays = Fix( intSecsTotal / 86400 )
intSecsRemaining = ( intSecsTotal - ( intDays * 86400 ))
intSecsTotal = intSecsRemaining
intHours = Fix( intSecsTotal / 3600 )
intSecsTotal = ( intSecsTotal - ( intHours * 3600 ))
intMinutes = Fix( intSecsTotal / 60 )
intSecsTotal = ( intSecsTotal - ( intMinutes * 60 ))
intSeconds = Fix( intSecsTotal )
//uptimeTxt.innerText = intDays & " days " & intHours & " hours " & intMinutes & " minutes"
uptimeTxt.innerText = intDays & "D " & intHours & "H " & intMinutes & "M " & intSeconds & "S "
setTimeout "uptime()", GetUpdateInterval()
WMIDateStringToDate = CDate(Mid(dtmBootup, 5, 2) & "/" & _
Mid(dtmBootup, 7, 2) & "/" & Left(dtmBootup, 4) _
& " " & Mid (dtmBootup, 9, 2) & ":" & _
Mid(dtmBootup, 11, 2) & ":" & Mid(dtmBootup,13, 2))