My First Dabble Into Ajax: dmiessler.com/time
By Daniel Miessler on December 28th, 2006: Tagged as Programming | Time | Tools
Given my new watch I have been checking the time a lot lately (it’s an obsession). Normally I go to time.gov, but I grew tired of doing that and decided to make my own resource for doing this (much like my /ip page for checking my outgoing IP address). I’ve been wanting to mess with Ajax anyway, so I figured this was a good opportunity.
Since my main server for this site synchronizes via NTP it’s quite accurate, so I decided to employ a bit of Ajax to create a dynamically updating time display that uses my server as the source. I started with Justin’s nifty template, simplified it a bit, made it start upon page load instead of through a button, and used some CSS to format it — pretty simple stuff really.
The result is precisely what I was looking for:
- A very accurate time display coming from my own site
- Doesn’t require Java (yuk)
- Allows you to watch the seconds tick by in real time (great for setting watches)
I love building things — no matter how simple.