473,394 Members | 1,869 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

uptime?

Hello,

how can I get the time, the pc is on?

thx
Nov 15 '05 #1
4 2361
Dirk,

You should be able to call the GetTickCount API function through the
P/Invoke layer. This will give you the number of ticks that have elapsed
since the system was turned on. You can then get the system resolution
through a call to the GetSystemTimeAdjustment function as well.

However, in the documentation for the GetTickCount function, it states:

To obtain the time elapsed since the computer was started, retrieve the
System Up Time counter in the performance data in the registry key
HKEY_PERFORMANCE_DATA. The value returned is an 8-byte value. For more
information, see Performance Monitoring.

So you should use the registry classes (or the performance counter
classes) to access this information.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- nick(dot)paldino=at=exisconsulting<dot>com

"Dirk Reske" <Fr******@gmx.net> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Hello,

how can I get the time, the pc is on?

thx

Nov 15 '05 #2
Dirk,

You should be able to call the GetTickCount API function through the
P/Invoke layer. This will give you the number of ticks that have elapsed
since the system was turned on. You can then get the system resolution
through a call to the GetSystemTimeAdjustment function as well.

However, in the documentation for the GetTickCount function, it states:

To obtain the time elapsed since the computer was started, retrieve the
System Up Time counter in the performance data in the registry key
HKEY_PERFORMANCE_DATA. The value returned is an 8-byte value. For more
information, see Performance Monitoring.

So you should use the registry classes (or the performance counter
classes) to access this information.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- nick(dot)paldino=at=exisconsulting<dot>com

"Dirk Reske" <Fr******@gmx.net> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Hello,

how can I get the time, the pc is on?

thx

Nov 15 '05 #3
Hi,
"Dirk Reske" <Fr******@gmx.net> schrieb im Newsbeitrag
news:%2***************@tk2msftngp13.phx.gbl...
how can I get the time, the pc is on?


try Environment.TickCount.

Sascha
Nov 15 '05 #4
Hi,
"Dirk Reske" <Fr******@gmx.net> schrieb im Newsbeitrag
news:%2***************@tk2msftngp13.phx.gbl...
how can I get the time, the pc is on?


try Environment.TickCount.

Sascha
Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Oli Schwarz | last post by:
Hello, how can I read out the uptime of a unix system in python (Linux and *BSD). I have not found a uptime-function in the Library. Regards Oli
24
by: Esmail Bonakdarian | last post by:
Hi, Is there a way to display how long a Win XP system has been up? Somewhat analogous to the *nix uptime command. Thanks, Esmail
6
by: MA | last post by:
Hi all! I know there is other newsgroups for webservices, but I donīt get any answers on those. I have developed a webservice that writeing and reading files in different folders. Question...
4
by: Brian Henry | last post by:
does anyone know of an easy way to say how long has a specific system been up and running? I just need to get back the uptime of the servers on our network for a report, they are all in a Active...
4
by: Dylan Parry | last post by:
Hi, I'm looking for a way to calculate the amount of time that Windows has been running since the last boot. Ideally I'd like to be able to create a DateTime object containing this value so that...
0
by: streamkid | last post by:
hello.. could anyone please help me build a uptime script for openbsd? i tried phpsysinfo, it doesn't work (only uptime works, and that's around 15k days :p) i tried these: <?php...
8
by: Guy Macon | last post by:
How to increase web server uptime with DNS failover: For illustration, let's start with some really bad hosting... Find four free web hosts that are each 90% reliable -- in other words they...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.