ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Main Area and Open Discussion > Living Room

Windows Install Date Thingie: I made it!

<< < (10/16) > >>

Ralf Maximus:
Yikes!  Something indeed is weird.

The first number (Install Date) comes straight out of the registry; I'm just reading the number and displaying it.  Reasons that number might be wrong for you (just guessing):

- Machine came from a vendor who pre-installed Windows years ago, then imaged it.  They build new PCs by installing the image.

- Some other app twiddled the registry setting in question for some mysterious and unknowable-by-man reason.

- Registry got "fixed" at one time in the past by restoring a backup from a registry cleaning tool, and the backup was from an old version.

The second number (alive time) comes from the WMI (Windows Management Instrumentation) "last reboot" date.  Again, that's the number handed over by Windows when that value is requested.  A logical person might assume Windows is actually resetting that value upon startup, but I'm not certain of anything anymore...

I'll do some research on when WMI resets that value and see what I can learn.  Anyone with more WMI knowledge/experience than I please feel free to chime in.

uryan:
What WMI class are you using?

With Win32_OperatingSystem.LastBootUpTime I get the correct boot time as a datetime

With Win32_PerfFormattedData_PerfOS_System.SystemUpTime I get the correct uptime in seconds

Ralf Maximus:
LastBootUpTime.  And it works on every piece of hardware I own.

Yarrrrrr!

Under what circumstances wouldn't this work?  Can WMI be subverted or get confused?

uryan:
Nothing wrong with WMI. You are using some region-sensitive conversions in there.

Ralf Maximus:
Nothing wrong with WMI. You are using some region-sensitive conversions in there.
-uryan (November 06, 2007, 03:26 PM)
--- End quote ---

MMmmmmaybe, but everything else I've done has been regionally sensitive (see the screenshots from the UK and Europe above to see what I mean). 

I'll check the source code and make sure I'm not assuming anything.  Thanks for the tip!

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version