Examples of TimeInfo


Examples of org.apache.commons.net.ntp.TimeInfo

        InetAddress host = InetAddress.getByName( null );

        NTPUDPClient ntp = new NTPUDPClient();
        ntp.setDefaultTimeout( 500000 );

        TimeInfo timeInfo = ntp.getTime( host, port );
        long returnTime = timeInfo.getReturnTime();
        assertTrue( currentTime - returnTime < 1000 );

        timeInfo.computeDetails();

        assertTrue( 0 < timeInfo.getOffset() && timeInfo.getOffset() < 1000 );
        assertTrue( 0 < timeInfo.getDelay() && timeInfo.getDelay() < 1000 );
    }
View Full Code Here

Examples of org.apache.commons.net.ntp.TimeInfo

            {
                System.out.println();
                try {
                    InetAddress hostAddr = InetAddress.getByName(args[i]);
                    System.out.println("> " + hostAddr.getHostName() + "/" + hostAddr.getHostAddress());
                    TimeInfo info = client.getTime(hostAddr);
                    processResponse(info);
                } catch (IOException ioe) {
                    ioe.printStackTrace();
                }
            }
View Full Code Here

Examples of org.apache.commons.net.ntp.TimeInfo

        NTPUDPClient ntp = new NTPUDPClient();
        ntp.setDefaultTimeout( 500000 );

        long currentTime = System.currentTimeMillis();
        TimeInfo timeInfo = ntp.getTime( host, port );
        long returnTime = timeInfo.getReturnTime();
        assertTrue( Math.abs( currentTime - returnTime ) < 1000 );

        timeInfo.computeDetails();

        String offsetMsg = "Expected offset in range (-1000, 1000), but was " + timeInfo.getOffset();
        assertTrue( offsetMsg, -1000 < timeInfo.getOffset() && timeInfo.getOffset() < 1000 );
        String delayMsg = "Expected delay in range [0, 1000), but was " + timeInfo.getOffset();
        assertTrue( delayMsg, 0 <= timeInfo.getDelay() && timeInfo.getDelay() < 1000 );
    }
View Full Code Here

Examples of org.apache.commons.net.ntp.TimeInfo

        NTPUDPClient ntp = new NTPUDPClient();
        ntp.setDefaultTimeout( 500000 );

        long currentTime = System.currentTimeMillis();
        TimeInfo timeInfo = ntp.getTime( host, port );
        long returnTime = timeInfo.getReturnTime();
        assertTrue( Math.abs( currentTime - returnTime ) < 1000 );

        timeInfo.computeDetails();

        String offsetMsg = "Expected offset in range (-1000, 1000), but was " + timeInfo.getOffset();
        assertTrue( offsetMsg, -1000 < timeInfo.getOffset() && timeInfo.getOffset() < 1000 );
        String delayMsg = "Expected delay in range [0, 1000), but was " + timeInfo.getOffset();
        assertTrue( delayMsg, 0 <= timeInfo.getDelay() && timeInfo.getDelay() < 1000 );
    }
View Full Code Here

Examples of org.apache.commons.net.ntp.TimeInfo

        NTPUDPClient ntp = new NTPUDPClient();
        ntp.setDefaultTimeout( 500000 );

        long currentTime = System.currentTimeMillis();
        TimeInfo timeInfo = ntp.getTime( host, port );
        long returnTime = timeInfo.getReturnTime();
        assertTrue( Math.abs( currentTime - returnTime ) < 1000 );

        timeInfo.computeDetails();

        String offsetMsg = "Expected offset in range (-1000, 1000), but was " + timeInfo.getOffset();
        assertTrue( offsetMsg, -1000 < timeInfo.getOffset() && timeInfo.getOffset() < 1000 );
        String delayMsg = "Expected delay in range [0, 1000), but was " + timeInfo.getOffset();
        assertTrue( delayMsg, 0 <= timeInfo.getDelay() && timeInfo.getDelay() < 1000 );
    }
View Full Code Here

Examples of org.apache.commons.net.ntp.TimeInfo

            {
                System.out.println();
                try {
                    InetAddress hostAddr = InetAddress.getByName(arg);
                    System.out.println("> " + hostAddr.getHostName() + "/" + hostAddr.getHostAddress());
                    TimeInfo info = client.getTime(hostAddr);
                    processResponse(info);
                } catch (IOException ioe) {
                    ioe.printStackTrace();
                }
            }
View Full Code Here

Examples of org.apache.commons.net.ntp.TimeInfo

   
    try {
      NTPUDPClient timeClient = new NTPUDPClient();
      timeClient.setDefaultTimeout(NTP_TIMEOUT);
      InetAddress inetAddress = InetAddress.getByName(hostname);
      TimeInfo timeInfo = timeClient.getTime(inetAddress);
     
      return timeInfo.getReturnTime();
    }
    catch (UnknownHostException uhe) {
      logger.warn("the given hostname '{}' of the timeserver is unknown -> returning current sytem time instead", hostname);
    }
    catch (IOException ioe) {
View Full Code Here

Examples of quicktime.std.movies.TimeInfo

   * @param mov        Movie to calculate interval for
   * @return interval  Interval between first two interesting frames in mov
   */
  public int getInterval(Movie mov)
  {
    TimeInfo time = null;
    try
    {
      // get the video track from the movie
      Track visualTrack = mov.getIndTrackType(1,
        StdQTConstants.visualMediaCharacteristic,
View Full Code Here

Examples of quicktime.std.movies.TimeInfo

    mov.setTime(new TimeRecord(timeScale, (int) begin));
    Boolean go = true;
    int lastTime = 0;
    do
    {
      TimeInfo ti = visualTrack.getNextInterestingTime(
        StdQTConstants.nextTimeMediaSample, mov.getTime(), 1);

      // if looped to earlier frame or finished selected section
      if ((lastTime > ti.time) || (ti.time >= finish))
      {
View Full Code Here

Examples of quicktime.std.movies.TimeInfo

      {
        if (Thread.interrupted())
        {
          throw new SchemeException(new Pair(), null, null);
        } // if (Thread.interrupted())
        TimeInfo ti = visualTrack.getNextInterestingTime(
          StdQTConstants.nextTimeMediaSample, mov.getTime(), 1);

        // if looped to earlier frame or finished selected section
        if ((lastTime > ti.time) || (ti.time >= finish))
        {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.