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

  • SEARCH
  • Home
  • 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 7496733
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T18:45:39+00:00 2026-05-29T18:45:39+00:00

In my application I have a Server and x Clients. When a Client starts,

  • 0

In my application I have a Server and x Clients. When a Client starts, he obtained the current System time from the Server. Every Client has to work with the Server time and can´t use his own System time.

Now my Question: What is the best way to run a clock on the Client that starts with the current Server time and run nearly synchronous to it without to receive the Server time every x seconds?

The goal is to display a runing clock with the Server time on the client.

The tolerance that the client clock may have is about 1second in 24hours.

In my solution I got a Timer that trigger every 500ms and count 500ms on the Server time when the Timer executes. But this is not a good solution 🙂 because the Client clock differ from the Server time.

Thanks for your reply

  • 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-29T18:45:43+00:00Added an answer on May 29, 2026 at 6:45 pm

    I find a Solution that fits perfectly for my situation.
    Instead of using System.currentTimeMillis(), I’m using System.nanoTime().
    System.nanoTime() is independent from the System clock.

    When I receive the current Server time, I save additional the ns from the System. Then the current Server time will be calculated with the difference between the ns time from Server time receiving and the current nanoTime plus the Server time.

    Example:

    // The Client starts and receive the current Server time and the nanoTime
    private long         serverTime = server.getCurrentTime();
    private long         systemNano = System.nanoTime();
    
    //To calculate the current Server time without a service call
                                                                            //ns-> ms
    long currentServerTime = serverTime + ((System.nanoTime() - systemNano) / 1000000);
    

    Thx

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

Sidebar

Related Questions

I have a client/server application that communicates with .Net remoting. I need my clients
I have a client-server application that uses .net remoting. The clients are in a
I have a client/server application. One of the clients is a CLI. The CLI
We have a Server/Client cybercafe management application which used to work fine on Windows
I have a client server application that sends XML over TCP/IP from client to
i have a server - client application that runs on java 1.3; i want
I have a client-server Silverlight application, which is use Socets. I have server appliaction
I am developing an application in C# WPF which will have Client-Server architecture (Client
I have a Client/Server application, where the Client and Server have some common tables
We have a client/server application with a rich client front end (in .Net) and

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.