Lost Password?

Go Back   CodeCall Programming Forum > Software Development > C# Programming

C# Programming C# (pronounced C-sharp) is a new object oriented language from Microsoft and is derived from C and C++. It also borrows a lot of concepts from Java too including garbage collection.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-16-2006, 08:51 AM
hoser2001's Avatar   
hoser2001 hoser2001 is offline
Programmer
 
Join Date: Jul 2006
Posts: 175
Rep Power: 9
hoser2001 is on a distinguished road
Default Here is a Code Execution Timer

Code:
System.DateTime tm = System.DateTime.Now;
//Place this before the code you wish to test.

System.DateTime tma = System.DateTime.Now;
System.IO.StreamWriter sw = System.IO.File.AppendText("C:\\TimeTest.txt");
sw.WriteLine((((((tma.Hour * (24 * 60 * 1000)) + (tma.Minute * (60 * 1000))) + (tma.Second * 1000)) + tma.Millisecond) - ((((tm.Hour * (24 * 60 * 1000)) + (tm.Minute * (60 * 1000))) + (tm.Second * 1000)) + tm.Millisecond)));
sw.Flush();
//place this after your code
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 08-16-2006, 09:20 PM
brackett brackett is offline
Programmer
 
Join Date: May 2006
Posts: 193
Rep Power: 10
brackett is on a distinguished road
Default

You can subtract DateTime directly and get a TimeSpan object...Just use (tma - tm).
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 08-19-2006, 12:25 PM
Nightracer's Avatar   
Nightracer Nightracer is offline
Programmer
 
Join Date: Jun 2006
Posts: 130
Rep Power: 9
Nightracer is on a distinguished road
Default

This is a nice bit of code. Good for debugging. I never thought of putting execution time in my application software.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Basic Calculator AfTriX VB Tutorials 3 02-29-2008 08:53 AM
Please Help With A C Program!! siren C and C++ 7 04-17-2007 08:45 AM
Where to Put PHP Code clookid PHP Tutorials 1 01-11-2007 08:44 PM


All times are GMT -5. The time now is 09:24 AM.

Contest Stats

GoogleKeyw ........ 20.00000

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 67%

Ads