Example usage for org.joda.time.format DateTimeParserBucket computeMillis

List of usage examples for org.joda.time.format DateTimeParserBucket computeMillis

Introduction

In this page you can find the example usage for org.joda.time.format DateTimeParserBucket computeMillis.

Prototype

public long computeMillis(boolean resetFields) 

Source Link

Document

Computes the parsed datetime by setting the saved fields.

Usage

From source file:org.jpmml.evaluator.TypeUtil.java

License:Open Source License

@SuppressWarnings(value = { "deprecation" })
static private Seconds parseSeconds(String value) {
    DateTimeFormatter format = SecondsSinceMidnight.getFormat();

    DateTimeParser parser = format.getParser();

    DateTimeParserBucket bucket = new DateTimeParserBucket(0, null, null);
    bucket.setZone(null);//from www.j  av a  2 s . c o  m

    int result = parser.parseInto(bucket, value, 0);
    if (result >= 0 && result >= value.length()) {
        long millis = bucket.computeMillis(true);

        return Seconds.seconds((int) (millis / 1000L));
    }

    throw new IllegalArgumentException(value);
}