Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6956969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:56:18+00:00 2026-05-27T14:56:18+00:00

Is there some window variable in javascript that I can use or a way

  • 0

Is there some window variable in javascript that I can use or a way to use a timer to track elapsed time without using a date object? flash.utils.getTimer works great in the flash version of this application and I’m trying to port it to javascript. I can’t risk changes to the system clock causing security problems, so I don’t want to use the Date object.

I have a servertimestamp and I would like to create a timer that is independent of the operating system time to calculate the current server time. I’ll use this calculated value to allow different operations during windows on the server time. I’m not concerned about javascript hacking as I know there’s no security there, but I would like to prevent the casual user from messing around with the availability of certain features.

Thanks

Added for clarification:

This project relates to live video events. The live video has a start time relative to the server and through another webservice I am able to grab the server time. What I need to do is to maintain this server time on the client machine independently of the user’s local time to determine when the live stream should start and stop on the client. So the problem isn’t really the format that I store the server time, it’s how do I get the elapsed time from when I grabbed the server time without using a date object.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T14:56:19+00:00Added an answer on May 27, 2026 at 2:56 pm

    You could create your own timer object:

    function Timer(init, precision) {
      var start = time = new Date(init || null).valueOf(),
          precision = precision || 100;
    
      setInterval(function () { time += precision; }, precision);
    
      this.elapsed = function() { return time - start; };
      this.getDate = function() { return new Date(time); };
    }
    

    and use it:

    var t = new Timer();    // default timer
    /* ... do things ... */
    alert( t.elapsed() );   // a millisecond value
    alert( t.getDate() );   // a Date object
    

    Use the init parameter to start the timer with any given date value you prefer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

the window.open() object has some funky parameter list... is there a way to do
I have a javascript function (function1) that checks some global variables (can the user
I need this for some animation effects and i remember there is a window
Is there some default Windows scripting language that comes pre-installed on XP and Vista
Are there some resources where one can learn how to develop for Windows Phone
There is some documentation on the internet that shows that Windows changes the behavior
I'm a JSP newbie, I understand that there are some kind of taglib files
I have a case where I have a variable in my JavaScript that will
I have some javascript that manipulates html based on what the user has selected.
I hope someone can help me. I have a website that uses javascript to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.