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!

 

 

To clarify this a bit more.  The Javascript will keep the clock up to date, but I need to use a NTP server to start it off.  I am not aware of how to do this in Javascript, or if it could be provided by a script I already have in PHP.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.