NodeGuy / server-date

Make the server's clock available in the browser.
http://www.nodeguy.com/serverdate/
Mozilla Public License 2.0
193 stars 53 forks source link

de-duplicate js code between the two versions #44

Closed MoralCode closed 3 years ago

MoralCode commented 3 years ago

It seems to me like the PHP addon is pretty much just serving (nearly) the same javascript and just inserting a more precise time to the millisecond at the end.

Since the client side implementation already reads the time from the HTTP Date header, it might help reduce the duplication of code between the two if the PHP version just set a custom header (like X-Precise-Date, just so you arent messing with the Date header) that contains the date as a string that's parseable by Date() in js if it exists.

NodeGuy commented 3 years ago

Let's just kill the PHP code in your PR. We can bring it back in the future if someone asks for greater precision.