Example usage for java.time.temporal ChronoField NANO_OF_SECOND

List of usage examples for java.time.temporal ChronoField NANO_OF_SECOND

Introduction

In this page you can find the example usage for java.time.temporal ChronoField NANO_OF_SECOND.

Prototype

ChronoField NANO_OF_SECOND

To view the source code for java.time.temporal ChronoField NANO_OF_SECOND.

Click Source Link

Document

The nano-of-second.

Usage

From source file:Main.java

public static void main(String[] args) {
    Instant instant = Instant.parse("2014-12-03T10:15:30.00Z");
    System.out.println(instant.get(ChronoField.NANO_OF_SECOND));

}

From source file:Main.java

public static void main(String[] args) {
    Instant instant = Instant.parse("2014-12-03T10:15:30.00Z");
    System.out.println(instant.range(ChronoField.NANO_OF_SECOND));

}

From source file:Main.java

public static void main(String[] args) {
    Instant instant = Instant.parse("2014-12-03T10:15:30.00Z");
    System.out.println(instant.getLong(ChronoField.NANO_OF_SECOND));

}

From source file:com.microsoft.sqlserver.testframework.sqlType.SqlTime.java

public SqlTime() {
    super("time", JDBCType.TIME, null, null);
    type = java.sql.Time.class;
    try {/*from  w  w w.  j a  va  2  s  .c o  m*/
        minvalue = new Time(dateFormat.parse((String) SqlTypeValue.TIME.minValue).getTime());
        maxvalue = new Time(dateFormat.parse((String) SqlTypeValue.TIME.maxValue).getTime());
    } catch (ParseException ex) {
        fail(ex.getMessage());
    }
    this.precision = 7;
    this.variableLengthType = VariableLengthType.Precision;
    generatePrecision();
    formatter = new DateTimeFormatterBuilder().appendPattern(basePattern)
            .appendFraction(ChronoField.NANO_OF_SECOND, 0, this.precision, true).toFormatter();

}

From source file:com.microsoft.sqlserver.testframework.sqlType.SqlDateTime2.java

public SqlDateTime2() {
    super("datetime2", JDBCType.TIMESTAMP, null, null);
    try {/*from   w ww .j a v a2  s. c om*/
        minvalue = new Timestamp(dateFormat.parse((String) SqlTypeValue.DATETIME2.minValue).getTime());
        maxvalue = new Timestamp(dateFormat.parse((String) SqlTypeValue.DATETIME2.maxValue).getTime());
    } catch (ParseException ex) {
        fail(ex.getMessage());
    }
    this.precision = 7;
    this.variableLengthType = VariableLengthType.Precision;
    generatePrecision();
    formatter = new DateTimeFormatterBuilder().appendPattern(basePattern)
            .appendFraction(ChronoField.NANO_OF_SECOND, 0, this.precision, true).toFormatter();

}

From source file:com.github.aptd.simulation.datamodel.CXMLReader.java

@Override
@SuppressWarnings("unchecked")
public final IExperiment get(final IFactory p_factory, final String p_datamodel, final long p_simulationsteps,
        final boolean p_parallel, final String p_timemodel,
        final Supplier<RealDistribution> p_platformchangedurationdistributionsupplier,
        final int p_numberofpassengers, final double p_lightbarrierminfreetime, final double p_delayseconds) {
    try (final FileInputStream l_stream = new FileInputStream(p_datamodel)) {
        final Asimov l_model = (Asimov) m_context.createUnmarshaller().unmarshal(l_stream);

        // time definition

        final Instant l_starttime = ZonedDateTime.now(ZoneId.systemDefault())
                .with(ChronoField.CLOCK_HOUR_OF_DAY, 8).with(ChronoField.MINUTE_OF_HOUR, 45)
                .with(ChronoField.SECOND_OF_MINUTE, 0).with(ChronoField.NANO_OF_SECOND, 0)
                .with(ChronoField.DAY_OF_MONTH, 3).with(ChronoField.MONTH_OF_YEAR, 10)
                .with(ChronoField.YEAR, 2017).toInstant();

        final ITime l_time = "jump".equals(p_timemodel) ? new CJumpTime(l_starttime, p_simulationsteps)
                : new CStepTime(l_starttime, Duration.ofSeconds(1), p_simulationsteps);

        final CMessenger l_messenger = new CMessenger();

        final Set<IAction> l_actionsfrompackage = CCommon.actionsFromPackage().collect(Collectors.toSet());

        // asl agent definition
        final Map<String, String> l_agentdefs = agents(l_model.getAi());

        // macro (train-network) and microscopic model
        final Map<String, IPlatform<?>> l_platform = platform(l_model.getNetwork(), l_agentdefs, p_factory,
                l_time);//from   w ww .j a  va2  s. c  o  m
        final Map<String, IStation<?>> l_station = station(l_model.getNetwork(), l_agentdefs, p_factory, l_time,
                l_platform);
        final Pair<Map<String, ITrain<?>>, Map<String, IDoor<?>>> l_train = train(l_model.getNetwork(),
                l_agentdefs, p_factory, l_time, p_lightbarrierminfreetime);

        final Map<String, IElement<?>> l_agents = new HashMap<>();
        l_agents.putAll(l_platform);
        l_agents.putAll(l_station);
        l_agents.putAll(l_train.getLeft());
        l_agents.putAll(l_train.getRight());

        final CExperiment l_experiment = new CExperiment(p_simulationsteps, p_parallel, IStatistic.EMPTY,
                l_agents, l_time, l_messenger);

        // @todo create passengersources and their passenger generators according to scenario definition

        final IElement.IGenerator<IPassenger<?>> l_passengergenerator = passengergenerator(p_factory,
                "+!activate <-\n    state/transition\n.", l_actionsfrompackage, l_time);

        l_experiment.addAgent("passengersource_test",
                passengersourcegenerator(p_factory, "+!activate <-\n    state/transition\n.",
                        l_actionsfrompackage, l_time).generatesingle(new UniformRealDistribution(0.0, 1.0),
                                l_time.current().toEpochMilli(), p_numberofpassengers, l_passengergenerator,
                                l_experiment, l_agents.get("toy-node-1"),
                                p_platformchangedurationdistributionsupplier.get()));

        l_messenger.experiment(l_experiment);

        // experiment (executable model)
        return l_experiment;

    } catch (final Exception l_execption) {
        throw new CRuntimeException(l_execption);
    }
}