ntp interview questions
Top ntp frequently asked interview questions
Is there a method in C# that returns the UTC (GMT) time zone? Not based on the system's time.
Basically I want to get the correct UTC time even if my system time is not right.
Source: (StackOverflow)
I have an issue with a Virtual Machine (VMWare/Ubuntu) that is getting out of time sync. We decided that the best thing to do was to get the time directly from an NTP server so I started researching a script to do that but nothing works so far, that's why I decided to come here and see if someone can point me in the right direction.
To clarify, I'm looking for a way to connect to a Time Server via PHP to retrieve the time directly and reuse it on a timestamp that I need to generate not to sync the server.
Source: (StackOverflow)
I'm looking for a way to synchronize time between clients with a good precision (let's say 0.5 seconds at least).
I exclude using jsontime or exploiting timestamp in server response headers due to a poor precision (a second or maybe less).
UPDATE:
It should work even with mobile connections. It's not unfrequent (e.g. here in Italy) that 3G connections itself have a round trip time around 0.5s, so algorithm has to be robust.
Source: (StackOverflow)
I am currently working on a license manager using java, I will be specifying a start and end date for my application so I can force a licensed user to re-license the program after a certain amount of time.
But the problem I am facing is that any one can roll-back their system date and time in order to maintain the validity of license. Is there any way in Java to detect the system date and time is changed. I have already tried Network Time Protocol to get the current date and time from a time server.
Source: (StackOverflow)
Was using Java Timer, Then switched to ScheduledExecutorService, but my problem is not fixed.
As Tasks scheduled before system time change (through ntpd) are not executed on delay specified. Have no logs for same as nothing happens :(.
using jre 1.6.0_26 64 bit in my target on 64 bit linux.
Update: ScheduledExecutorService works fine on Windows. Problem is only on 64 bit Linux based system running 64 bit JVM. It works fine
on
64 bit linux running 32 bit JVM...strange. Have not found any reference of same on any blogs either.
IBM's JAVA SDK has same problem
(ibm-java-sdk-7.0-0.0-x86_64-archive.bin).
I had filed defect against JDK 7139684,It was accepted but has been closed and
marked duplicate of 6900441. Please vote for it , if you feel
its worth to get it fixed... I have no idea why its not been fixed since more than couple of years
Here is sample code I used to test this issue:
package test;
import java.io.IOException;
import java.util.Date;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
/**
* @author yogesh
*
*/
public class TimerCheck implements Runnable {
ScheduledExecutorService worker;
public TimerCheck(ScheduledExecutorService worker) {
super();
this.worker = worker;
this.worker.schedule(this, 1, TimeUnit.SECONDS);
}
private static void update() {
System.out.println("TimerCheck.update() "+new Date(System.currentTimeMillis()));
}
@Override
public void run() {
update();
worker.schedule(this, 1, TimeUnit.SECONDS);
}
/**
* @param args
*/
public static void main(String[] args) {
ScheduledExecutorService worker = Executors.newScheduledThreadPool(1);
new TimerCheck(worker);
}
}
Source: (StackOverflow)
I have dockers running on Linode servers. At times, I see that the time is not right on the dockers. Currently I have changed the run script in every docker to include the following lines of code.
yum install -y ntp
service ntpd stop
ntpdate pool.ntp.org
What I would ideally like to do however is that the docker should sync time with the host. Is there a way to do this?
Source: (StackOverflow)
Hello
I'm writing a counting script who counts the time between an old date and today.
Everything worked good until I tested on a computer with wrong date and saw the results.
So I found a way to get NTP time via http://json-time.appspot.com/time.json.
The problem is that I need the current time every millisecond because I want to count the milliseconds but Its impossible the send request to the NTP server every milisecond.
This is some example code to see what I'm writing about
var today;
$(document).ready(function(){
$.data = function(success){
$.get("http://json-time.appspot.com/time.json?callback=?", function(response){
success(new Date(response.datetime));
}, "json");
};
});
function update(){
var start = new Date("March 25, 2011 17:00:00");
//var today = new Date();
$.data(function(time){
today = time;
});
var bla = today.getTime() - start.getTime();
$("#milliseconds").text(bla);
}
setInterval("update()", 1);
Source: (StackOverflow)
I need my software to communicate with an NTP server to determine the local clock offset. I have tried using the org.apache.commons.net.ntp package, but its implementation is rather poor when running on Windows, because of the use of System.currentTimeMillis() to determine the time before and after the NTP packet exchange. As you may or may not know, this value is only updated when the system clock ticks, which on most modern Win2k3 servers is at 64Hz or every 15.625ms. This greatly limits the accuracy of the clock offset calculation.
Ntpd uses the CPU high-frequency timer to interpolate between system clock ticks, and achieve much higher resolution time. Do you know of a Java implementation that uses this or a similar technique? Or do you know of any other NTP implementation other than Apache's?
Source: (StackOverflow)
The Wikipedia entry doesn't give details and the RFC is way too dense. Does anyone around here know, in a very general way, how NTP works?
I'm looking for an overview that explains how Marzullo's algorithm (or a modification of it) is employed to translate a timestamp on a server into a timestamp on a client. Specifically what mechanism is used to produce accuracy which is, on average, within 10ms when that communication takes place over a network with highly variable latency which is frequently several times that.
Source: (StackOverflow)
I've recently known about a gps.conf
file in the /system/etc/
directory.
Seems that tweaking NTP_SERVER values to NTP servers nearer to the usual location improves TTFF.
Reading the source code in the LocationProvider
class, seems that at boot, time is retrieved from NTP server and "injected" in the calculations.
AFAIK each GPS sat has a very accurate atomic clock, and every one in the constellation is synchronized to the so called "GPS time". Once the receiver has got 4 or more satellites, it solves (by some method) an equation where there are four unknowns: x,y,z,b; where (x,y,z) is the receiver location, and b is the time difference between the receiver internal clock and the (correct) GPS time. Once it has a a fix, the receiver clock is synced with the correct time. (Please correct me if I'm wrong).
So far, I've some questions regarding the way NTP time injection works:
- GPS Time is roughly TAI (International Atomic Time) plus an offset. Those two times do not depend on the Earth rotation, however UTC does. Given that NTP servers return UTC time, it is possible to infer GPS Time from UTC time?
- How does retrieving NTP time from a nearer server improve the "quality" of the GPS time approximation?
- Assuming that we have an initial GPS Time value (inferred from NTP time somehow), what is the injection about? Is this time value taken as correct to solve the equation with only x,y,z as unknowns? If so, then the first fix is also just an approximation, isn't it?
- How does a higher quality initial approximation for GPS time improve TTFF? Is it because with a lower quality NTP time the first fixes are considered not acceptable and discarded?
- Does having an approximate initial position help retrieving the next correct fix (like listening only to a subset of sats)?
Source: (StackOverflow)
I am writing an application that requires accurate timing. After asking this question, I have decided to investigate using NTP or maybe Simple NTP.
Is there any open source implementation of these protocols for the iPhone? So far I have managed to find a broken link. I am also aware that NTP has a C reference implementation, so I am trying to see how much effort it would require to make it work on the iPhone.
Update: I thought I had a working link, but it is to the Wayback Machine, which only saves text, not files link that works.
Source: (StackOverflow)
Do Android Devices use the network time protocol (NTP) to synchronize the time?
In my Device-Settings I see a checkbox with the following text "synchronize with network", but I don't know if they are using NTP.
I need this for my Bachelor Thesis for which I use GPS. To get a accurate GPS-signal the receiver should have a exact clock.
I found this blog-entry on the web, but I'm not sure if he tell the truth: Speeding up NTP, GPS Lock in Android
Source: (StackOverflow)
Giving I already changed the timezone of docker container correctly. Do I need to install a NTP server inside the docker container to periodically sync the time or the container will sync the time from its host machine?
Source: (StackOverflow)
All I need is a way to query an NTP Server using C# to get the Date Time of the NTP Server returned as either a string
or as a DateTime
.
How is this possible in its simplest form?
Source: (StackOverflow)
I noticed that if I set my device time manually, and turn off the automatic time sync on my iOS device, [NSDate date]
returns the date and time assuming the device time is correct--which it may not be.
Since the docs mention that NSDate
has some sort of sync with NTP, I am wondering if there is any built-in way to get the accurate date and time instead of having to assume the device date and time is correct.
Source: (StackOverflow)