Tabnine Logo
System.currentTimeMillis
Code IndexAdd Tabnine to your IDE (free)

How to use
currentTimeMillis
method
in
java.lang.System

Best Java code snippets using java.lang.System.currentTimeMillis (Showing top 20 results out of 159,696)

origin: spring-projects/spring-framework

/**
 * Start the expiration period for this instance.
 * @param timeToLive the number of seconds before expiration
 */
public void startExpirationPeriod(int timeToLive) {
  this.expirationTime = System.currentTimeMillis() + timeToLive * 1000;
}
origin: spring-projects/spring-framework

/**
 * Return whether this instance has expired depending on the amount of
 * elapsed time since the call to {@link #startExpirationPeriod}.
 */
public boolean isExpired() {
  return (this.expirationTime != -1 && System.currentTimeMillis() > this.expirationTime);
}
origin: spring-projects/spring-framework

/**
 * Create a new ApplicationEvent.
 * @param source the object on which the event initially occurred (never {@code null})
 */
public ApplicationEvent(Object source) {
  super(source);
  this.timestamp = System.currentTimeMillis();
}
origin: ReactiveX/RxJava

/**
 * Returns the 'current time' of the Scheduler in the specified time unit.
 * @param unit the time unit
 * @return the 'current time'
 * @since 2.0
 */
public long now(@NonNull TimeUnit unit) {
  return unit.convert(System.currentTimeMillis(), TimeUnit.MILLISECONDS);
}
origin: ReactiveX/RxJava

/**
 * Returns the 'current time' of the Worker in the specified time unit.
 * @param unit the time unit
 * @return the 'current time'
 * @since 2.0
 */
public long now(@NonNull TimeUnit unit) {
  return unit.convert(System.currentTimeMillis(), TimeUnit.MILLISECONDS);
}
origin: square/okhttp

/**
 * Sets the certificate to be valid immediately and until the specified duration has elapsed.
 * The precision of this field is seconds; further precision will be truncated.
 */
public Builder duration(long duration, TimeUnit unit) {
 long now = System.currentTimeMillis();
 return validityInterval(now, now + unit.toMillis(duration));
}
origin: square/okhttp

/**
 * Attempt to parse a {@code Set-Cookie} HTTP header value {@code setCookie} as a cookie. Returns
 * null if {@code setCookie} is not a well-formed cookie.
 */
public static @Nullable Cookie parse(HttpUrl url, String setCookie) {
 return parse(System.currentTimeMillis(), url, setCookie);
}
origin: spring-projects/spring-framework

@Override
public final synchronized void refresh() {
  logger.debug("Attempting to refresh target");
  this.targetObject = freshTarget();
  this.refreshCount++;
  this.lastRefreshTime = System.currentTimeMillis();
  logger.debug("Target refreshed successfully");
}
origin: spring-projects/spring-framework

private void updateSessionReadTime(@Nullable String sessionId) {
  if (sessionId != null) {
    SessionInfo info = this.sessions.get(sessionId);
    if (info != null) {
      info.setLastReadTime(System.currentTimeMillis());
    }
  }
}
origin: ReactiveX/RxJava

  @Override
  public void run() {
    times.add(System.currentTimeMillis());
  }
}, 100, 100, TimeUnit.MILLISECONDS);
origin: ReactiveX/RxJava

  @Override
  public void run() {
    times.add(System.currentTimeMillis());
  }
}, 100, 100, TimeUnit.MILLISECONDS);
origin: spring-projects/spring-framework

@Override
public ScheduledFuture<?> scheduleAtFixedRate(Runnable task, Date startTime, long period) {
  long initialDelay = startTime.getTime() - System.currentTimeMillis();
  try {
    return this.scheduledExecutor.scheduleAtFixedRate(decorateTask(task, true), initialDelay, period, TimeUnit.MILLISECONDS);
  }
  catch (RejectedExecutionException ex) {
    throw new TaskRejectedException("Executor [" + this.scheduledExecutor + "] did not accept task: " + task, ex);
  }
}
origin: ReactiveX/RxJava

void sleep() throws Exception {
  cb.await();
  try {
    long before = System.currentTimeMillis();
    Thread.sleep(5000);
    throw new IllegalStateException("Was not interrupted in time?! " + (System.currentTimeMillis() - before));
  } catch (InterruptedException ex) {
    // ignored here
  }
}
origin: ReactiveX/RxJava

void beforeCancelSleep(BaseTestConsumer<?, ?> ts) throws Exception {
  long before = System.currentTimeMillis();
  Thread.sleep(50);
  if (System.currentTimeMillis() - before > 100) {
    ts.dispose();
    throw new IllegalStateException("Overslept?" + (System.currentTimeMillis() - before));
  }
}
origin: spring-projects/spring-framework

public WebResponse build() throws IOException {
  WebResponseData webResponseData = webResponseData();
  long endTime = System.currentTimeMillis();
  return new WebResponse(webResponseData, this.webRequest, endTime - this.startTime);
}
origin: spring-projects/spring-framework

@Override
public ScheduledFuture<?> schedule(Runnable task, Date startTime) {
  ScheduledExecutorService executor = getScheduledExecutor();
  long initialDelay = startTime.getTime() - System.currentTimeMillis();
  try {
    return executor.schedule(errorHandlingTask(task, false), initialDelay, TimeUnit.MILLISECONDS);
  }
  catch (RejectedExecutionException ex) {
    throw new TaskRejectedException("Executor [" + executor + "] did not accept task: " + task, ex);
  }
}
origin: spring-projects/spring-framework

@Override
public ScheduledFuture<?> scheduleWithFixedDelay(Runnable task, Date startTime, long delay) {
  ScheduledExecutorService executor = getScheduledExecutor();
  long initialDelay = startTime.getTime() - System.currentTimeMillis();
  try {
    return executor.scheduleWithFixedDelay(errorHandlingTask(task, true), initialDelay, delay, TimeUnit.MILLISECONDS);
  }
  catch (RejectedExecutionException ex) {
    throw new TaskRejectedException("Executor [" + executor + "] did not accept task: " + task, ex);
  }
}
origin: ReactiveX/RxJava

@Override
public void subscribe(Subscriber<? super String> t1) {
  t1.onSubscribe(new BooleanSubscription());
  System.out.println(count.get() + " @ " + String.valueOf(last - System.currentTimeMillis()));
  last = System.currentTimeMillis();
  if (count.getAndDecrement() == 0) {
    t1.onNext("hello");
    t1.onComplete();
  } else {
    t1.onError(new RuntimeException());
  }
}
origin: ReactiveX/RxJava

@Override
public void subscribe(Observer<? super String> t1) {
  t1.onSubscribe(Disposables.empty());
  System.out.println(count.get() + " @ " + String.valueOf(last - System.currentTimeMillis()));
  last = System.currentTimeMillis();
  if (count.getAndDecrement() == 0) {
    t1.onNext("hello");
    t1.onComplete();
  } else {
    t1.onError(new RuntimeException());
  }
}
origin: spring-projects/spring-framework

public void testSendAttributeChangeNotificationWhereSourceIsNotTheManagedResource() throws Exception {
  StubSpringModelMBean mbean = new StubSpringModelMBean();
  Notification notification = new AttributeChangeNotification(this, 1872, System.currentTimeMillis(), "Shall we break for some tea?", "agree", "java.lang.Boolean", Boolean.FALSE, Boolean.TRUE);
  ObjectName objectName = createObjectName();
  NotificationPublisher publisher = new ModelMBeanNotificationPublisher(mbean, objectName, mbean);
  publisher.sendNotification(notification);
  assertNotNull(mbean.getActualNotification());
  assertTrue(mbean.getActualNotification() instanceof AttributeChangeNotification);
  assertSame("The exact same Notification is not being passed through from the publisher to the mbean.", notification, mbean.getActualNotification());
  assertSame("The 'source' property of the Notification is *wrongly* being set to the ObjectName of the associated MBean.", this, mbean.getActualNotification().getSource());
}
java.langSystemcurrentTimeMillis

Javadoc

Returns the current time in milliseconds since January 1, 1970 00:00:00.0 UTC.

This method always returns UTC times, regardless of the system's time zone. This is often called "Unix time" or "epoch time". Use a java.text.DateFormat instance to format this time for display to a human.

This method shouldn't be used for measuring timeouts or other elapsed time measurements, as changing the system time can affect the results. Use #nanoTime for that.

Popular methods of System

  • getProperty
    Returns the value of a particular system property. The defaultValue will be returned if no such prop
  • arraycopy
  • exit
  • setProperty
    Sets the value of a particular system property.
  • nanoTime
    Returns the current timestamp of the most precise timer available on the local system, in nanosecond
  • getenv
    Returns the value of the environment variable with the given name, or null if no such variable exist
  • getProperties
    Returns the system properties. Note that this is not a copy, so that changes made to the returned Pr
  • identityHashCode
    Returns an integer hash code for the parameter. The hash code returned is the same one that would be
  • getSecurityManager
    Gets the system security interface.
  • gc
    Indicates to the VM that it would be a good time to run the garbage collector. Note that this is a h
  • lineSeparator
    Returns the system's line separator. On Android, this is "\n". The value comes from the value of the
  • clearProperty
    Removes a specific system property.
  • lineSeparator,
  • clearProperty,
  • setOut,
  • setErr,
  • console,
  • loadLibrary,
  • load,
  • setSecurityManager,
  • mapLibraryName

Popular in Java

  • Finding current android device location
  • addToBackStack (FragmentTransaction)
  • getSystemService (Context)
  • setContentView (Activity)
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • JPanel (javax.swing)
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now