Jump to content

Javascript Clock with time based on NTP server that is pulled using PHP


bubbasheeko

Recommended Posts

I am developing a time card app, but have run into an issue that I didn't think of when I started the project. 

 

I want to display a digital clock on the screen that auto increments.  So this would be Javascript.  However, the problem I didn't think of at the time I came up with the idea was where the Javascript would get the time.  Javascript defaults to the time of the user's computer.  Obviously for a timecard app I would not want the user changing the time on their computer to look like they were in on time.  So, I then thought of just using their main computer to pull the time, but this system is accessible by each of the employees.  Then it hit me.  I could pull the time from a NTP server.

 

Now, I know how to pull the time from the NTP server with PHP.  What I don't know is how I can get Javascript to grab that time and start incrementing it so that it can be used when the 'punch' form is submitted.  I already have a plan if the time can not be grabbed from the NTP server.

 

If anybody could get me started or point me in the right direction that would be great!

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.