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 823291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T02:55:38+00:00 2026-05-15T02:55:38+00:00

I’m developing an web application using asp.net mvc, and i need to do a

  • 0

I’m developing an web application using asp.net mvc, and i need to do a stopwatch (chronometer) (with 30 seconds preprogrammed to start in a certain moment) on client-side using the time of the server, by the way, the client’s clock can’t be as the server’s clock. So, i’m using Jquery to call the server by JSon and get the time, but it’s very stress because each one second I call the server to get time, something like this:

$(function() {
  GetTimeByServer();
});

function GetTimeByServer() {
  $.getJSon('/Home/Time', null, function(result) {
    if (result.SecondsPending < 30) {
      // call another function to start an chronometer
    } else {
      window.SetTimeout(GetTimeByServer, 1000); //call again each 1 second!
    }
  });
}

It works fine, but when I have more than 3 or 4 call like this, the browser slowly but works! I’d like to know, how improve more performace in client side, or if is there any way to do this… is there any way to client listen the server like a “socket” to know if the chronometer should start…

PS: Sorry for my english!

thanks
Cheers

  • 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-15T02:55:39+00:00Added an answer on May 15, 2026 at 2:55 am

    Felipe,
    On page load get the server time and also the Client Side time. and use the two in reference to determine what the server time is on the server side without using AJAX call every time. Sorry for the excess of suedo code but it shouldnt be too hard.

    var ServerTimeReference;
    var ClientTimeReference;
    function InitializeTime()
       $.getJSon('/Home/Time', null, function (result) {
           ServerTimeReference = result.ServerTime; //convert to js time 
           ClientTimeReference = new Date();
         });
    
    function GetServerTime() { 
         var TimeDifference = //get the difference between server and Client time
         var CurrentClientDateTime = new Date();
         var CurrentServerTime = // using timedifference and CurrentClientDateTime calculate ServerTime
         return CurrentServerTime;
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 427k
  • Answers 427k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Without actually running the document through the layout engine there's… May 15, 2026 at 1:00 pm
  • Editorial Team
    Editorial Team added an answer How about public static void DoSomething<T>( ClassA<T> p_val) {} This… May 15, 2026 at 1:00 pm
  • Editorial Team
    Editorial Team added an answer The java AES library has a flaw in it that… May 15, 2026 at 1:00 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.