iEntry 10th Anniversary Webforumz RegistrationAnnouncements Contact Webforumz StaffContact
Home Resources Blogs Meet the Team Contact Register
 

Go Back   WebForumz.com > The Code > JavaScript

Reply
 
LinkBack (1) Thread Tools
Old April 1st, 2007, 12:02 PM   1 links from elsewhere to this Post. Click to view. #1
Most Reputable Member
 
spinal007's Avatar
 

Join Date: Mar 2004
Location: Good Ol'London
Age: 24
Posts: 1,683
Blog Entries: 1
Thanks: 1
Thanked 4 Times in 4 Posts
Rep Altering Power: 0 spinal007 has a spectacular aura about spinal007 has a spectacular aura about
Javascript Timer

I just thought I'd share this little snippet I put together last night...

A (very) simple JavaScript timer object. I use it to help me measure how long scripts take to execute...

timer.start(); // starts counting
timer.since(); // returns elapsed time in milliseconds

The code:
Code:
var timer = {
  time: 0,
  now: function(){ return (new Date()).getTime(); },
  start: function(){ this.time = this.now(); },
  since: function(){ return this.now()-this.time; }
}
As posted on my new blog: Javascript Timer.
__________________
Diego - Web-Developer & London SEO Expert
jQuery Plugins: Multiple File Upload, Star Rating, FCKEditor | NEW: XML to JSON
spinal007 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Bookmarks

Tags
blog , javascript , jquery , stopwatch , timer


LinkBacks (?)
LinkBack to this Thread: http://webforumz.com/javascript/29522-javascript-timer.htm
Posted By For Type Date
chambaka's Bookmarks on Delicious This thread Refback October 20th, 2008 09:36 PM

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

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
Timer won't work gleb JavaScript 1 September 12th, 2007 05:43 AM
1st timer hosting questions jimbaines Web Hosting and Domains 16 June 21st, 2007 08:27 AM
request for help in countdown timer thebmwz4 Classic ASP 4 September 4th, 2005 11:45 AM
Self Updating Timer. Amin PHP 4 June 24th, 2005 03:37 PM


Search Engine Optimization by vBSEO 3.2.0 RC8