If accuracy is that important to you, using URLFetch would not be accurate
enough.

If you use URLFetch, and the request takes say 400ms, you've no idea where
the actual timestamp belongs in that window. In theory its the middle but
because you don't know the relative delays of the send/receive phases, its
not guaranteed.

In theory, you could use the experimental Sockets API, to actually use the
NTP protocol itself, actually get a more accurate value.

But it would take time (many seconds) for the time to actually sync. So you
would need to say run a backend/module, that maintains time, locked via NTP
to a server somewhere. Which your front end apps queries via an API. In
theory a API connection to the back end is less susceptible to network
delays than to a external NTP server. And it might be possible maintain the
current skew, in a global veriable that persists between requests, so every
request doesnt 'have' to make the RPC.


.... but appengine already undertakes to maintain server time via NTP
anyway, so it wont really give you any benefit. (so this is all bit of a
thought experiment!)


This might also be of interest:
https://www.google.com/search?q=%22Google+Production+time%22



On Thu, Jul 25, 2013 at 5:53 PM, Evan Ruff <evan.r...@gmail.com> wrote:

> Hey guys,
>
> I'm curious to hear about any strategies people have used to employ time
> synchronization among the AppEngine instances. I'm working on a project
> that is looking to have a pretty important time component and the current
> strategy I'm looking at is something long the lines of:
>
> 1. Record System.currentTimeMils()
> 2. URLFetch to an NTP server somewhere
> 3. Note return time
> 4. Correct NTP time using the start time to get request time.
>
> Is this how other people are handling it? Is there another way that might
> be simpler? I'm a little hesitant to run an URLFetch for each request,
> obviously.
>
> Thanks!
>
> E
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to google-appengine+unsubscr...@googlegroups.com.
> To post to this group, send email to google-appengine@googlegroups.com.
> Visit this group at http://groups.google.com/group/google-appengine.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

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


Reply via email to