Mar 16, 2004 #1 Plato2 Programmer Joined Dec 6, 2002 Messages 192 Location US I want to check how long my application was open.And if it was open a certain period of time , i need to call a certain function. Thanks in advance
I want to check how long my application was open.And if it was open a certain period of time , i need to call a certain function. Thanks in advance
Mar 16, 2004 #2 chiph Programmer Joined Jun 9, 1999 Messages 9,878 Location US Use DateTime.Now when it starts, then call DateTime.Now when it ends, then subtract the two values (giving you a TimeSpan object). Chip H. If you want to get the best response to a question, please check out FAQ222-2244 first Upvote 0 Downvote
Use DateTime.Now when it starts, then call DateTime.Now when it ends, then subtract the two values (giving you a TimeSpan object). Chip H. If you want to get the best response to a question, please check out FAQ222-2244 first
Mar 18, 2004 1 #3 SHelton Programmer Joined Jun 10, 2003 Messages 541 Location GB You don't need to store the start time, use the following at any time and it will give you the uptime of your application. Code: Dim ts As TimeSpan = DateTime.op_Subtraction(DateTime.Now, System.Diagnostics.Process.GetCurrentProcess.StartTime) Console.WriteLine("Application running for {0} hours, {1} minutes, {2} seconds", ts.Hours, ts.Minutes, ts.Seconds) Upvote 0 Downvote
You don't need to store the start time, use the following at any time and it will give you the uptime of your application. Code: Dim ts As TimeSpan = DateTime.op_Subtraction(DateTime.Now, System.Diagnostics.Process.GetCurrentProcess.StartTime) Console.WriteLine("Application running for {0} hours, {1} minutes, {2} seconds", ts.Hours, ts.Minutes, ts.Seconds)
Mar 18, 2004 #4 Eurt Programmer Joined Feb 9, 2004 Messages 9 Location US SHelton, How do you past you code in like that? Upvote 0 Downvote
Mar 18, 2004 #5 SHelton Programmer Joined Jun 10, 2003 Messages 541 Location GB It's called TGML - see http://www.tipmaster.com/includes/tgmlinfo.cfm?w=450&h=450 Upvote 0 Downvote
Mar 18, 2004 Thread starter #6 Plato2 Programmer Joined Dec 6, 2002 Messages 192 Location US Thanks a lot that what I'm looking for Upvote 0 Downvote