Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #37481
| From | Eric Sosman <esosman@comcast-dot-net.invalid> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Is time an illusion? |
| Date | 2017-09-26 15:37 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <oqea94$tu8$1@dont-email.me> (permalink) |
| References | <oqbp1u$947$1@dont-email.me> <oqbud2$h8k$1@dont-email.me> <oqbv8t$mp1$1@dont-email.me> |
On 9/25/2017 6:16 PM, Daniele Futtorovic wrote:
> On 2017-09-26 00:02, Eric Sosman wrote:
>> On 9/25/2017 4:30 PM, Daniele Futtorovic wrote:
>>> Cheers,
>>>
>>> I'm trying to synchronise a process between two machines (actual, not
>>> virtual). I require sub-millisecond precision.
>>>
>>> I initialise clocks backed by System#nanoTime() on each end and
>>> synchronise them somehow (there'll be some deviation at this point.
>>> Doesn't matter). Subsequently, I time my process on each end relative to
>>> this starting point.
>>>
>>> I have the impression that I'm seeing time drift in this process.
>>> Disregarding measurement errors, the differences between the clocks seem
>>> to increase over time.
>>>
>>> Q: Is this to be expected? I've been trying to read up on it a bit
>>> (Oracle memory-holing all the sun.com blogs doesn't help), but wanted
>>> some confirmation: is time really an illusion? Are 10^9 nanoseconds on
>>> box A possibly not 10^9 nanoseconds on box B?
>>
>> It's expected. If the oscillators underlying the two machines'
>> clocks run at rates that differ by only 0.001% -- one part in a
>> hundred thousand -- the clock readings will diverge by 860-odd
>> milliseconds per day.
>>
>>> If so, seriously, what the heck? I'm aware I might have stumbled on a
>>> very elementary truth here after so many years in the business, but I
>>> must say, the idea itself feels deeply unsettling.
>>>
>>> Existential musings aside, would any of you have suggestions as to how
>>> tackle the issue?
>>
>> http://www.ntp.org/
>>
>> "Serious" systems already have NTP implementations, so it may just
>> be a matter of enabling the service on both machines and making sure
>> firewalls and such don't prevent them from reaching public time servers.
>>
>> I'm no expert on this, but I think that if the two machines run
>> NTP independently they may adjust themselves at different moments,
>> leading to disagreements of a different sort. The solution (I'd
>> imagine, as a non-expert) would be to have one machine sync externally
>> and then turn around and act as the time server for the other.
>
> I don't think NTP would be a good fit for me. If I have to adjust clocks
> periodically anyway, I can do that within my setup; I just need to elect
> one end as the master and go from there. But is there perhaps something
> I could tap, even if I have to go native, or do I really have to accept
> that I just can't ever have congruent time intervals across potentially
> heterogeneous hardware?
>
> Also, if there is a drift, can I expect that drift to be constant? That
> is, if I observe that box A ticks, say, 1% faster than box B over a
> given interval of time, can I assume that it will do so for /any/ given
> interval of time? I guess not, right?
I can't think of any reason to expect constant drift. The machines
don't operate at constant temperature, nor at constant voltage, nor at
constant age ... In my (very brief) look at the NTP documentation I
found a glossary of terms. There's a word for the first derivative
of a clock's tick rate; the protocol anticipates that the rate is not
a constant. There's even a word for the *second* derivative of the
tick rate; not even the rate of change of rate is considered constant!
I'm somewhat curious about why you need such lock-step agreement.
What are you trying to accomplish? Why do you need to measure the
same interval on two independent stopwatches?
--
esosman@comcast-dot-net.invalid
Twelve hundred twelve days to go.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Is time an illusion? Daniele Futtorovic <da.futt.news@laposte.net> - 2017-09-25 22:30 +0200
Re: Is time an illusion? Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-09-25 18:02 -0400
Re: Is time an illusion? Daniele Futtorovic <da.futt.news@laposte.net> - 2017-09-26 00:16 +0200
Re: Is time an illusion? Jerry Stuckle <jstucklex@attglobal.net> - 2017-09-25 19:18 -0400
Re: Is time an illusion? Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-09-26 15:37 -0400
Re: Is time an illusion? Daniele Futtorovic <da.futt.news@laposte.net> - 2017-09-27 01:13 +0200
Re: Is time an illusion? Jerry Stuckle <jstucklex@attglobal.net> - 2017-09-26 21:00 -0400
Re: Is time an illusion? Daniele Futtorovic <da.futt.news@laposte.net> - 2017-09-27 04:26 +0200
Re: Is time an illusion? Jerry Stuckle <jstucklex@attglobal.net> - 2017-09-26 23:32 -0400
Re: Is time an illusion? Daniele Futtorovic <da.futt.news@laposte.net> - 2017-09-28 10:58 +0200
Re: Is time an illusion? Jerry Stuckle <jstucklex@attglobal.net> - 2017-09-28 12:50 -0400
Re: Is time an illusion? Eric Douglas <e.d.programmer@gmail.com> - 2017-09-27 05:25 -0700
Re: Is time an illusion? Arne Vajhøj <arne@vajhoej.dk> - 2017-09-30 22:57 -0400
Re: Is time an illusion? Arne Vajhøj <arne@vajhoej.dk> - 2017-09-25 20:22 -0400
Re: Is time an illusion? Marcel Mueller <news.5.maazl@spamgourmet.org> - 2017-09-26 20:18 +0200
Re: Is time an illusion? Daniele Futtorovic <da.futt.news@laposte.net> - 2017-09-27 01:30 +0200
Re: Is time an illusion? lewbloch@gmail.com - 2017-09-28 10:52 -0700
Re: Is time an illusion? Eric Douglas <e.d.programmer@gmail.com> - 2017-09-26 12:59 -0700
Re: Is time an illusion? Daniele Futtorovic <da.futt.news@laposte.net> - 2017-09-27 01:42 +0200
Re: Is time an illusion? lewbloch@gmail.com - 2017-09-28 10:49 -0700
Re: Is time an illusion? Robert Klemme <shortcutter@googlemail.com> - 2017-09-28 22:33 +0200
csiph-web