java interface to internet time server?
Posted on 2007-03-22
I don't know if this is possible, but I'm hoping someone has heard of something like this. I'm creating a java/jsp/postgres web app and I need to insert a timestamp with timezone into the database when I do an insert. I currently have this working by using pl/pgsql to create a trigger function that inserts 'now' into the date_submitted field in my database table. This is all great, except I am running my application on a hosted server and they never update the server for daylight savings time, etc, so I end up with errors in my data when it is inserted (it basically ends up inserting an incorrect timezone because it is currently an hour off).
Instead of relying on my hosted server time being accurately updated all of the time, I'm hoping that someone knows of a java interface to an internet time server that I can use to obtain the a current timestamp. For example, a method like: getCurrentTime(tz); that qurried the internet for the current time and returned a Java TimeStamp object for the timezone passed in.
Does anyone know if something like this exists? All I can seem to find is information relating to synchronizing a system clock.
Thanks in advance,