/** * 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); }
/** * 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; }
private void pauseSimulator(Attributes attributes) throws SAXException { long usec = 0; int i; for (i = 0; i < attributes.getLength(); i++) { String attName = attributes.getQName(i); String attValue = expandEnvVars(attributes.getValue(i)); if (attName.equals(SIM_XML_ATTR_MSEC)) { usec = Long.parseLong(attValue) * 1000L; } else if (attName.equals(SIM_XML_ATTR_USEC)) { usec = Long.parseLong(attValue); } else { throw new SAXParseException("Unknown <" + SIM_XML_SLEEP + "> attribute '" + attName + "'", saxLocator); } } if (usec > 0) { simCurrTime.add(0L, TNT4JSimulator.varyValue(usec)); TNT4JSimulator.trace(simCurrTime, "Executed sleep, usec=" + usec); } }
add(0, usecs);
simCurrTime.add(0, elapsed); curEvent.stop(simCurrTime, elapsed); TNT4JSimulator.debug(simCurrTime, "Ran event: " + name + ", elapsed.usec=" + elapsed);