473,774 Members | 2,105 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help,How to get the total time elapsed since the system started(more than 1 month)

I can using Environment.Tic kCount property to get the time elapsed since the
system started. but this property using A 32-bit signed integer type, so
it's can't count the time more than 24.9 days.
How can I do ?

tks
Nov 17 '05 #1
2 3087
Hi Rene,

I dont' think it is possible. The TickCount is taken from the system clock, so if the system is up and running for 25+ days this counter is reset.

If you are measuring how long your application have been running, try stamping the startup and measure the TimeSpan to DateTime.Now;
On Sat, 01 Oct 2005 09:32:58 +0200, Rene Ren <re**@vip.139sc .com> wrote:
I can using Environment.Tic kCount property to get the time elapsed since the
system started. but this property using A 32-bit signed integer type, so
it's can't count the time more than 24.9 days.
How can I do ?

tks


--
Happy coding!
Morten Wennevik [C# MVP]
Nov 17 '05 #2
"Rene Ren" <re**@vip.139sc .com> wrote in
news:#K******** ******@TK2MSFTN GP11.phx.gbl:
I can using Environment.Tic kCount property to get the time
elapsed since the system started. but this property using A
32-bit signed integer type, so it's can't count the time more
than 24.9 days. How can I do ?


A performance counter can give you that information:
using System;
using System.Diagnost ics;

namespace Example
{
public class ExampleClass
{
public static void Main()
{
PerformanceCoun ter pc = new PerformanceCoun ter("System", "System Up Time");
// The first call to NextValue() returns 0.0.
pc.NextValue();

// The second call to NextValue() returns the number of
// seconds that have elapsed since the machine was turned on.
TimeSpan ts = TimeSpan.FromSe conds((long) pc.NextValue()) ;

Console.WriteLi ne("System Up Time: {0} days, {1} hours, {2} minutes, {3} seconds", ts.Days, ts.Hours, ts.Minutes, ts.Seconds);
}
}
}
--
Hope this helps.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
Nov 17 '05 #3

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

Similar topics

4
2551
by: Support | last post by:
Hello, I am running RedHat & Apache. RedHat does not allow creating more that 32000 subdirectories in one folder due to #defined constant limitation in the core code. I need to display 47000 directories on web page: e.g. mydomain.com/andrew , mydomain.com/bill , etc. Each directory contains .html/htm files and image files (*.jpg, *gif, jpeg etc.)
12
1847
by: Hp | last post by:
Hi All, Thanks a lot for all your replies. My requirement is as follows: I need to read a text file, eliminate certain special characters(like ! , - = + ), and then convert it to lower case and then remove certain stopwords(like and, a, an, by, the etc) which is there in another txt file. Then, i need to run it thru a stemmer(a program which converts words like running to run, ie, converts them to roots words).
22
2359
by: Colin McGuire | last post by:
I apologize for posting yet another scrollbar question. Here is my code. All I want is for a diagonal line to appear from coordinates (0,0) to (width,height) in a usercontrol regardless of whether the user autoscrolls the usercontrol (other things that are on the usercontrol I want to scroll, but haven't included any here). Here are the steps to reproduce my problem. 1. Launch Visual Studio and create a new Windows application with...
7
2127
by: news.east.cox.net | last post by:
Hello, I'm trying to figure out why the following code won't work for me. The Firefox javascript console tells me that tableItemClicked is not defined, but the function is right there in the code. Any help would be greatly appreciated. <script type="text/javascript"> function Initialize() //is called upon page load {
2
1649
by: yellowarmy | last post by:
Theres two problems i have. 1) Theres a question i have to answer in a mock is that the company does invoices every month but i need it for to select invoice and then select the month whcih would then give you the invoices for the selected month. 2) The first is adding the number of outstanding invoices in the report footer in the Invoice. I use this text box = IIf(Min()<Date()-30,"Please Pay Up","") to calcualte if the invoice had been...
4
1230
by: Zytan | last post by:
I've sent the error report. But does that contain my code? I would imagine not, since it's a privacy concern. Can they really fix the problem without code? Maybe, but maybe not. I don't care if they have my code. It's just a test app anyway. Is there any way to send a *better* error report. Like: "Here, compile this on your own machine, and watch it go boom: " Zytan
1
1648
by: ganeshpillai | last post by:
I want to write a progeam that displays date in the following format (dd/mm/yyyy) 09/06/2007 or 9/6/2007 .
0
1201
by: balach | last post by:
hi all, i am using this code to initialize and assign it to a process, i am calling a thread on every 10 Seconds to fire vbscript file, this activity is performed on "timer1_Tick( )" event and give me required information. some times i face problem that the second thread associated with "Dummy.vbs" script file, do not reach at specified remote machine, and give error message after 45 seconds to 1 minute, i want that to terminate its...
0
10267
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10040
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7463
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6717
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5355
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4012
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3611
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.