Codota Logo
UsecTimestamp
Code IndexAdd Codota to your IDE (free)

How to use
UsecTimestamp
in
com.jkoolcloud.tnt4j.core

Best Java code snippets using com.jkoolcloud.tnt4j.core.UsecTimestamp (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Charset c =
  • Codota IconString charsetName;Charset.forName(charsetName)
  • Codota IconCharset.defaultCharset()
  • Codota IconContentType contentType;contentType.getCharset()
  • Smart code suggestions by Codota
}
origin: com.jkoolcloud/tnt4j

/**
 * Gets the time the operation started.
 *
 * @return operation start time
 */
public UsecTimestamp getStartTime() {
  return new UsecTimestamp(startTimeUs);
}
origin: com.jkoolcloud/tnt4j

/**
 * Adds the specified UsecTimestamp to this one.
 *
 * @param other
 *            timestamp to add to current one
 */
public void add(UsecTimestamp other) {
  add(other.msecs, other.usecs);
}
origin: com.jkoolcloud/tnt4j

  /**
   * Purpose of this method is to make this class compatible with Groovy script standard for number operator "minus"
   * {@code '-'} overloading. See <a href="http://groovy-lang.org/operators.html">Groovy operators spec</a> section
   * "Operator overloading".
   * <p>
   * Performs same as {@link #difference(UsecTimestamp)}.
   *
   * @param other
   *            other UsecTimestamp instance
   * @return difference, in microseconds, between two timestamps
   *
   * @see #difference(UsecTimestamp)
   */
  public long minus(UsecTimestamp other) {
    return difference(other);
  }
}
origin: com.jkoolcloud/tnt4j

/**
 * {@inheritDoc}
 *
 * <p>
 * Returns {@link #getTimeUsec()}.
 * </p>
 */
@Override
public long longValue() {
  return getTimeUsec();
}
origin: com.jkoolcloud/jesl

simCurrTime = new UsecTimestamp();
simCurrTime.add(0, elapsed);
curEvent.stop(simCurrTime, elapsed);
TNT4JSimulator.debug(simCurrTime, "Ran event: " + name + ", elapsed.usec=" + elapsed);
origin: com.jkoolcloud/tnt4j

/**
 * Returns the string representation of the timestamp based on the default format pattern, microseconds.
 *
 * @param usecs
 *            microseconds
 * @return formatted date/time string based on pattern
 */
public static String getTimeStamp(long usecs) {
  long msecs = usecs / 1000L;
  return getTimeStamp(null, msecs, (usecs - msecs * 1000));
}
origin: com.jkoolcloud/tnt4j

setTimestampValues(date.getTime(), 0, 0);
add(0, usecs);
origin: com.jkoolcloud/tnt4j

/**
 * Creates UsecTimestamp based on specified UsecTimestamp.
 *
 * @param other
 *            timestamp to copy
 * @throws NullPointerException
 *             if timestamp is {@code null}
 */
public UsecTimestamp(UsecTimestamp other) {
  this(other.msecs, other.usecs, other.getLamportClock());
}
origin: com.jkoolcloud/tnt4j

@Override
public long getTime() {
  return timeStamp.getTimeMillis();
}
origin: com.jkoolcloud/tnt4j

/**
 * Creates UsecTimestamp based on specified Timestamp, providing time in seconds resolution, and fractional
 * microsecond.
 *
 * @param timestamp
 *            database timestamp, seconds resolution
 * @param usecs
 *            fraction microseconds
 * @throws NullPointerException
 *             if timestamp is {@code null}
 * @throws IllegalArgumentException
 *             if usecs is greater than 999999
 */
public UsecTimestamp(Timestamp timestamp, long usecs) {
  initFromTimestamp(timestamp, usecs);
}
origin: com.jkoolcloud/tnt4j

@Override
public int hashCode() {
  int prime = 31;
  int result = 1;
  UsecTimestamp ts = getStartTime();
  result = prime * result + ((opName == null) ? 0 : opName.hashCode());
  if (ts != null) {
    result = prime * result + ts.hashCode();
  }
  return result;
}
origin: com.jkoolcloud/tnt4j

/**
 * Creates UsecTimestamp based on specified millisecond timestamp and fractional microsecond.
 *
 * @param msecs
 *            timestamp, in milliseconds
 * @param usecs
 *            fraction microseconds
 * @param recvdLamportClock
 *            received Lamport clock
 * @throws IllegalArgumentException
 *             if any arguments are negative, or if usecs is greater than 999
 */
protected void setTimestampValues(long msecs, long usecs, long recvdLamportClock) {
  if (msecs < 0) {
    throw new IllegalArgumentException("msecs must be non-negative");
  }
  if (usecs < 0 || usecs > 999) {
    throw new IllegalArgumentException("usecs must be in the range [0,999], inclusive");
  }
  this.msecs = msecs;
  this.usecs = usecs;
  assignLamportClock(recvdLamportClock);
}
origin: com.jkoolcloud/tnt4j

/**
 * {@inheritDoc}
 *
 * <p>
 * Returns {@link #getTimeUsec()} as a double.
 * </p>
 */
@Override
public double doubleValue() {
  return getTimeUsec();
}
origin: com.jkoolcloud/tnt4j

/**
 * Returns the string representation of this timestamp in the specified timezone.
 *
 * @param tz
 *            timezone
 * @return formatted date/time string in specified timezone
 */
public String toString(TimeZone tz) {
  return getTimeStamp(null, tz, msecs, usecs);
}
origin: com.jkoolcloud/tnt4j

/**
 * {@inheritDoc}
 *
 * <p>
 * Returns {@link #getTimeUsec()} as an int, possibly truncated.
 * </p>
 */
@Override
public int intValue() {
  return (int) getTimeUsec();
}
origin: com.jkoolcloud/tnt4j

/**
 * Returns UsecTimestamp based on current time with microsecond precision/accuracy
 *
 * @return UsecTimestamp for current time
 * @see com.jkoolcloud.tnt4j.utils.Utils#currentTimeUsec
 */
public static UsecTimestamp now() {
  return new UsecTimestamp();
}
origin: com.jkoolcloud/tnt4j

/**
 * {@inheritDoc}
 * <p>
 * Returns the string representation of this timestamp in the default timezone.
 * </p>
 */
@Override
public String toString() {
  return getTimeStamp(msecs, usecs);
}
origin: com.jkoolcloud/tnt4j

/**
 * Purpose of this method is to make this class compatible with Groovy script standard for number operator "plus"
 * {@code '+'} overloading. See <a href="http://groovy-lang.org/operators.html">Groovy operators spec</a> section
 * "Operator overloading".
 * <p>
 * Performs same as {@link #add(UsecTimestamp)}.
 *
 * @param other
 *            timestamp to add to current one
 * @return current UsecTimestamp instance
 *
 * @see #add(UsecTimestamp)
 */
public UsecTimestamp plus(UsecTimestamp other) {
  add(other);
  return this;
}
origin: com.jkoolcloud/jesl

private void stopActivity() throws SAXException {
  long elapsed = simCurrTime.difference(curActivity.getStartTime());
  curActivity.stop(simCurrTime, elapsed);
  TNT4JSimulator.debug(simCurrTime, "Stopped activity " + curActivity.getName() + ", elapsed.usec: " + elapsed);
  if (curActivity.getStatus() == ActivityStatus.BEGIN) {
    curActivity.setStatus(ActivityStatus.END);
  }
  Tracker tracker = trackers.get(curActivity.getSource().getFQName());
  if (tracker != null) {
    tracker.tnt(curActivity);
    try {
      tracker.getEventSink().flush();
    } catch (IOException e) {
      TNT4JSimulator.warn("Failed flushing event sink on stop of activity " + curActivity.getName(), e);
    }
  }
  curActivity = activeActivities.pop();
  curActivityStart = null;
  curTracker = null;
}
origin: com.jkoolcloud/tnt4j

/**
 * {@inheritDoc}
 *
 * <p>
 * Returns {@link #getTimeUsec()} as a float, possibly truncated.
 * </p>
 */
@Override
public float floatValue() {
  return getTimeUsec();
}
com.jkoolcloud.tnt4j.coreUsecTimestamp

Javadoc

Represents a timestamp that has microsecond accuracy. This timestamp also implements Lamport clock synchronization algorithm see UsecTimestamp#getLamportClock() and UsecTimestamp#UsecTimestamp(long,long,long).

Stores timestamp as mmmmmmmmmm.uuu, where mmmmmmmmmm is the timestamp in milliseconds, and uuu is the fractional microseconds.

Most used methods

  • <init>
    Creates UsecTimestamp based on specified Date.
  • add
    Adds the specified UsecTimestamp to this one.
  • difference
    Computes the difference between this timestamp and the specified one (as this - other). It relates t
  • getTimeUsec
    Gets current time stamp value to microseconds resolution.
  • assignLamportClock
    Assign local Lamport clock based on the value of the received Lamport clock.
  • getLamportClock
    Returns Lamport clock value of this time stamp (based on Lamport Clock algorithm)
  • getTimeMillis
    Gets current time stamp value to milliseconds resolution.
  • getTimeStamp
    Returns the string representation of the current timestamp, with a given time zone.
  • hashCode
  • initFromTimestamp
  • now
    Returns UsecTimestamp based on current time with microsecond precision/accuracy
  • setTimeUsec
    Sets UsecTimestamp based on specified microsecond timestamp.
  • now,
  • setTimeUsec,
  • setTimestampValues,
  • subtract,
  • toString

Popular in Java

  • Start an intent from android
  • getExternalFilesDir (Context)
  • findViewById (Activity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • Iterator (java.util)
    An iterator over a collection. Iterator takes the place of Enumeration in the Java Collections Frame
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now