nanoTime() is used instead of currentTimeMillis() to avoid issues with
leap seconds.
Change-Id: Idbfcd994424c91a384c47fe0ad12bc6a7ea33972
Signed-off-by: Stephen Kitt <skitt@redhat.com>
import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
import static org.ops4j.pax.exam.CoreOptions.composite;
import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
import static org.ops4j.pax.exam.CoreOptions.composite;
-import java.util.Calendar;
-
import javax.inject.Inject;
import org.junit.Before;
import javax.inject.Inject;
import org.junit.Before;
@Before
public void setup() throws Exception {
super.setup();
@Before
public void setup() throws Exception {
super.setup();
- Calendar start = Calendar.getInstance();
+ long start = System.nanoTime();
ServiceReference<BindingAwareBroker> serviceReference = context.getServiceReference(BindingAwareBroker.class);
if(serviceReference == null) {
throw new RuntimeException("BindingAwareBroker not found");
ServiceReference<BindingAwareBroker> serviceReference = context.getServiceReference(BindingAwareBroker.class);
if(serviceReference == null) {
throw new RuntimeException("BindingAwareBroker not found");
broker.registerProvider(this);
for(int i=0;i<REGISTRATION_TIMEOUT;i++) {
if(session !=null) {
broker.registerProvider(this);
for(int i=0;i<REGISTRATION_TIMEOUT;i++) {
if(session !=null) {
- Calendar stop = Calendar.getInstance();
- LOG.info("Registered session {} with the MD-SAL after {} ms",
+ long stop = System.nanoTime();
+ LOG.info("Registered session {} with the MD-SAL after {} ns",
- stop.getTimeInMillis() - start.getTimeInMillis());
return;
} else {
Thread.sleep(1);
return;
} else {
Thread.sleep(1);
import java.net.Socket;
import java.util.ArrayList;
import java.util.Arrays;
import java.net.Socket;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Calendar;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
- l.print(Calendar.getInstance().getTime());
l.print(" - ");
l.println(str);
} catch (Exception err) {
l.print(" - ");
l.println(str);
} catch (Exception err) {
- l.print(Calendar.getInstance().getTime());
l.print(" - ");
e.printStackTrace(l);
} catch (Exception err) {
l.print(" - ");
e.printStackTrace(l);
} catch (Exception err) {