Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #37475

Re: Is time an illusion?

From Arne Vajhøj <arne@vajhoej.dk>
Newsgroups comp.lang.java.programmer
Subject Re: Is time an illusion?
Date 2017-09-25 20:22 -0400
Organization Aioe.org NNTP Server
Message-ID <oqc6ju$19to$1@gioia.aioe.org> (permalink)
References <oqbp1u$947$1@dont-email.me>

Show all headers | View raw


On 9/25/2017 4:30 PM, Daniele Futtorovic wrote:
> 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?
> 
> 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?

Clocks on computers tend to drift slightly.

By using an external time source you can keep time reasonable in sync.

Using a NTP server over the internet is common, but sub millisecond
precision is very hard to achieve with that.

Getting time from a GPS receiver should be better and may
accomplish your goals.

Arne



Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


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