Thursday, December 19, 2013

Calculating delta time Advice?

So I have a really simple problem and can't imagine that others haven't solved this but I'm not sure how to search it.

We've developed a cloud content management system using GWT front end and rails back end. So when a user upload a piece of content, creates a post, rates something, or basically does anything the server saves a created_by timestamp in the objects respective table by using the databases sysdate function.

Later when we get fetch these objects to display them we calculate the delta to display how long ago the change was made, just like youtube or any other content management system.

The problem is the sysdate function is using the servers system time. The delta is calculated by taking the system time from the machine that the UI is being viewed on and subtracting that sysdate we calculated before. So if one clock is faster or slower then the other our delta's aren't accurate.

Obviously one solution is, "dude fix your clock."

But is that the global solution to that problem or is there a common way to avoid this issue?

We found this because our nightly VM's system clock was 15 minutes slow so you upload a video and the delta gets calculated as uploaded 15 minutes ago.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment