Java Code Examples for org.joda.time.DateTimeConstants#MILLIS_PER_MINUTE

The following examples show how to use org.joda.time.DateTimeConstants#MILLIS_PER_MINUTE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: 1_BasicChronology.java    From SimFix with GNU General Public License v2.0 6 votes vote down vote up
public long getDateTimeMillis(
        int year, int monthOfYear, int dayOfMonth,
        int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond)
        throws IllegalArgumentException {
    Chronology base;
    if ((base = getBase()) != null) {
        return base.getDateTimeMillis(year, monthOfYear, dayOfMonth,
                                      hourOfDay, minuteOfHour, secondOfMinute, millisOfSecond);
    }

    FieldUtils.verifyValueBounds(DateTimeFieldType.hourOfDay(), hourOfDay, 0, 23);
    FieldUtils.verifyValueBounds(DateTimeFieldType.minuteOfHour(), minuteOfHour, 0, 59);
    FieldUtils.verifyValueBounds(DateTimeFieldType.secondOfMinute(), secondOfMinute, 0, 59);
    FieldUtils.verifyValueBounds(DateTimeFieldType.millisOfSecond(), millisOfSecond, 0, 999);

    return getDateMidnightMillis(year, monthOfYear, dayOfMonth)
        + hourOfDay * DateTimeConstants.MILLIS_PER_HOUR
        + minuteOfHour * DateTimeConstants.MILLIS_PER_MINUTE
        + secondOfMinute * DateTimeConstants.MILLIS_PER_SECOND
        + millisOfSecond;
}
 
Example 2
Source File: Nopol2017_0088_s.java    From coming with MIT License 6 votes vote down vote up
public long getDateTimeMillis(
        int year, int monthOfYear, int dayOfMonth,
        int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond)
        throws IllegalArgumentException {
    Chronology base;
    if ((base = getBase()) != null) {
        return base.getDateTimeMillis(year, monthOfYear, dayOfMonth,
                                      hourOfDay, minuteOfHour, secondOfMinute, millisOfSecond);
    }

    FieldUtils.verifyValueBounds(DateTimeFieldType.hourOfDay(), hourOfDay, 0, 23);
    FieldUtils.verifyValueBounds(DateTimeFieldType.minuteOfHour(), minuteOfHour, 0, 59);
    FieldUtils.verifyValueBounds(DateTimeFieldType.secondOfMinute(), secondOfMinute, 0, 59);
    FieldUtils.verifyValueBounds(DateTimeFieldType.millisOfSecond(), millisOfSecond, 0, 999);

    return getDateMidnightMillis(year, monthOfYear, dayOfMonth)
        + hourOfDay * DateTimeConstants.MILLIS_PER_HOUR
        + minuteOfHour * DateTimeConstants.MILLIS_PER_MINUTE
        + secondOfMinute * DateTimeConstants.MILLIS_PER_SECOND
        + millisOfSecond;
}
 
Example 3
Source File: Nopol2017_0088_t.java    From coming with MIT License 6 votes vote down vote up
public long getDateTimeMillis(
        int year, int monthOfYear, int dayOfMonth,
        int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond)
        throws IllegalArgumentException {
    Chronology base;
    if ((base = getBase()) != null) {
        return base.getDateTimeMillis(year, monthOfYear, dayOfMonth,
                                      hourOfDay, minuteOfHour, secondOfMinute, millisOfSecond);
    }

    FieldUtils.verifyValueBounds(DateTimeFieldType.hourOfDay(), hourOfDay, 0, 23);
    FieldUtils.verifyValueBounds(DateTimeFieldType.minuteOfHour(), minuteOfHour, 0, 59);
    FieldUtils.verifyValueBounds(DateTimeFieldType.secondOfMinute(), secondOfMinute, 0, 59);
    FieldUtils.verifyValueBounds(DateTimeFieldType.millisOfSecond(), millisOfSecond, 0, 999);

    return getDateMidnightMillis(year, monthOfYear, dayOfMonth)
        + hourOfDay * DateTimeConstants.MILLIS_PER_HOUR
        + minuteOfHour * DateTimeConstants.MILLIS_PER_MINUTE
        + secondOfMinute * DateTimeConstants.MILLIS_PER_SECOND
        + millisOfSecond;
}
 
Example 4
Source File: BasicChronology.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
public long getDateTimeMillis(
        int year, int monthOfYear, int dayOfMonth,
        int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond)
        throws IllegalArgumentException {
    Chronology base;
    if ((base = getBase()) != null) {
        return base.getDateTimeMillis(year, monthOfYear, dayOfMonth,
                                      hourOfDay, minuteOfHour, secondOfMinute, millisOfSecond);
    }

    FieldUtils.verifyValueBounds(DateTimeFieldType.hourOfDay(), hourOfDay, 0, 23);
    FieldUtils.verifyValueBounds(DateTimeFieldType.minuteOfHour(), minuteOfHour, 0, 59);
    FieldUtils.verifyValueBounds(DateTimeFieldType.secondOfMinute(), secondOfMinute, 0, 59);
    FieldUtils.verifyValueBounds(DateTimeFieldType.millisOfSecond(), millisOfSecond, 0, 999);

    return getDateMidnightMillis(year, monthOfYear, dayOfMonth)
        + hourOfDay * DateTimeConstants.MILLIS_PER_HOUR
        + minuteOfHour * DateTimeConstants.MILLIS_PER_MINUTE
        + secondOfMinute * DateTimeConstants.MILLIS_PER_SECOND
        + millisOfSecond;
}
 
Example 5
Source File: BasicChronology.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
public long getDateTimeMillis(
        int year, int monthOfYear, int dayOfMonth,
        int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond)
        throws IllegalArgumentException {
    Chronology base;
    if ((base = getBase()) != null) {
        return base.getDateTimeMillis(year, monthOfYear, dayOfMonth,
                                      hourOfDay, minuteOfHour, secondOfMinute, millisOfSecond);
    }

    FieldUtils.verifyValueBounds(DateTimeFieldType.hourOfDay(), hourOfDay, 0, 23);
    FieldUtils.verifyValueBounds(DateTimeFieldType.minuteOfHour(), minuteOfHour, 0, 59);
    FieldUtils.verifyValueBounds(DateTimeFieldType.secondOfMinute(), secondOfMinute, 0, 59);
    FieldUtils.verifyValueBounds(DateTimeFieldType.millisOfSecond(), millisOfSecond, 0, 999);

    return getDateMidnightMillis(year, monthOfYear, dayOfMonth)
        + hourOfDay * DateTimeConstants.MILLIS_PER_HOUR
        + minuteOfHour * DateTimeConstants.MILLIS_PER_MINUTE
        + secondOfMinute * DateTimeConstants.MILLIS_PER_SECOND
        + millisOfSecond;
}
 
Example 6
Source File: MusicGenerationJob.java    From computoser with GNU Affero General Public License v3.0 5 votes vote down vote up
@Scheduled(fixedDelay = 12 * DateTimeConstants.MILLIS_PER_MINUTE)
public void generate() {
    if (sharedData.isGenerateMusic()) {
        logger.info("Starting piece generation");
        //TODO more precise adjustment this according to users' listening activity
        int piecesNeeded = sharedData.isAdaptGenerationQuantity() && sharedData.getListeningRequests().get() > 10 ? 3 : 1;
        for (int i = 0; i < piecesNeeded; i ++) {
            long id = service.generatePiece();
            sharedData.setMaxId(id);
        }
        // reset
        sharedData.getListeningRequests().set(0);
    }
}
 
Example 7
Source File: Time_20_DateTimeFormatterBuilder_t.java    From coming with MIT License 4 votes vote down vote up
public void printTo(
        StringBuffer buf, long instant, Chronology chrono,
        int displayOffset, DateTimeZone displayZone, Locale locale) {
    if (displayZone == null) {
        return;  // no zone
    }
    if (displayOffset == 0 && iZeroOffsetPrintText != null) {
        buf.append(iZeroOffsetPrintText);
        return;
    }
    if (displayOffset >= 0) {
        buf.append('+');
    } else {
        buf.append('-');
        displayOffset = -displayOffset;
    }

    int hours = displayOffset / DateTimeConstants.MILLIS_PER_HOUR;
    FormatUtils.appendPaddedInteger(buf, hours, 2);
    if (iMaxFields == 1) {
        return;
    }
    displayOffset -= hours * (int)DateTimeConstants.MILLIS_PER_HOUR;
    if (displayOffset == 0 && iMinFields <= 1) {
        return;
    }

    int minutes = displayOffset / DateTimeConstants.MILLIS_PER_MINUTE;
    if (iShowSeparators) {
        buf.append(':');
    }
    FormatUtils.appendPaddedInteger(buf, minutes, 2);
    if (iMaxFields == 2) {
        return;
    }
    displayOffset -= minutes * DateTimeConstants.MILLIS_PER_MINUTE;
    if (displayOffset == 0 && iMinFields <= 2) {
        return;
    }

    int seconds = displayOffset / DateTimeConstants.MILLIS_PER_SECOND;
    if (iShowSeparators) {
        buf.append(':');
    }
    FormatUtils.appendPaddedInteger(buf, seconds, 2);
    if (iMaxFields == 3) {
        return;
    }
    displayOffset -= seconds * DateTimeConstants.MILLIS_PER_SECOND;
    if (displayOffset == 0 && iMinFields <= 3) {
        return;
    }

    if (iShowSeparators) {
        buf.append('.');
    }
    FormatUtils.appendPaddedInteger(buf, displayOffset, 3);
}
 
Example 8
Source File: Time_20_DateTimeFormatterBuilder_t.java    From coming with MIT License 4 votes vote down vote up
public void printTo(
        Writer out, long instant, Chronology chrono,
        int displayOffset, DateTimeZone displayZone, Locale locale) throws IOException {
    if (displayZone == null) {
        return;  // no zone
    }
    if (displayOffset == 0 && iZeroOffsetPrintText != null) {
        out.write(iZeroOffsetPrintText);
        return;
    }
    if (displayOffset >= 0) {
        out.write('+');
    } else {
        out.write('-');
        displayOffset = -displayOffset;
    }

    int hours = displayOffset / DateTimeConstants.MILLIS_PER_HOUR;
    FormatUtils.writePaddedInteger(out, hours, 2);
    if (iMaxFields == 1) {
        return;
    }
    displayOffset -= hours * (int)DateTimeConstants.MILLIS_PER_HOUR;
    if (displayOffset == 0 && iMinFields == 1) {
        return;
    }

    int minutes = displayOffset / DateTimeConstants.MILLIS_PER_MINUTE;
    if (iShowSeparators) {
        out.write(':');
    }
    FormatUtils.writePaddedInteger(out, minutes, 2);
    if (iMaxFields == 2) {
        return;
    }
    displayOffset -= minutes * DateTimeConstants.MILLIS_PER_MINUTE;
    if (displayOffset == 0 && iMinFields == 2) {
        return;
    }

    int seconds = displayOffset / DateTimeConstants.MILLIS_PER_SECOND;
    if (iShowSeparators) {
        out.write(':');
    }
    FormatUtils.writePaddedInteger(out, seconds, 2);
    if (iMaxFields == 3) {
        return;
    }
    displayOffset -= seconds * DateTimeConstants.MILLIS_PER_SECOND;
    if (displayOffset == 0 && iMinFields == 3) {
        return;
    }

    if (iShowSeparators) {
        out.write('.');
    }
    FormatUtils.writePaddedInteger(out, displayOffset, 3);
}
 
Example 9
Source File: Time_20_DateTimeFormatterBuilder_s.java    From coming with MIT License 4 votes vote down vote up
public void printTo(
        StringBuffer buf, long instant, Chronology chrono,
        int displayOffset, DateTimeZone displayZone, Locale locale) {
    if (displayZone == null) {
        return;  // no zone
    }
    if (displayOffset == 0 && iZeroOffsetPrintText != null) {
        buf.append(iZeroOffsetPrintText);
        return;
    }
    if (displayOffset >= 0) {
        buf.append('+');
    } else {
        buf.append('-');
        displayOffset = -displayOffset;
    }

    int hours = displayOffset / DateTimeConstants.MILLIS_PER_HOUR;
    FormatUtils.appendPaddedInteger(buf, hours, 2);
    if (iMaxFields == 1) {
        return;
    }
    displayOffset -= hours * (int)DateTimeConstants.MILLIS_PER_HOUR;
    if (displayOffset == 0 && iMinFields <= 1) {
        return;
    }

    int minutes = displayOffset / DateTimeConstants.MILLIS_PER_MINUTE;
    if (iShowSeparators) {
        buf.append(':');
    }
    FormatUtils.appendPaddedInteger(buf, minutes, 2);
    if (iMaxFields == 2) {
        return;
    }
    displayOffset -= minutes * DateTimeConstants.MILLIS_PER_MINUTE;
    if (displayOffset == 0 && iMinFields <= 2) {
        return;
    }

    int seconds = displayOffset / DateTimeConstants.MILLIS_PER_SECOND;
    if (iShowSeparators) {
        buf.append(':');
    }
    FormatUtils.appendPaddedInteger(buf, seconds, 2);
    if (iMaxFields == 3) {
        return;
    }
    displayOffset -= seconds * DateTimeConstants.MILLIS_PER_SECOND;
    if (displayOffset == 0 && iMinFields <= 3) {
        return;
    }

    if (iShowSeparators) {
        buf.append('.');
    }
    FormatUtils.appendPaddedInteger(buf, displayOffset, 3);
}
 
Example 10
Source File: Time_20_DateTimeFormatterBuilder_s.java    From coming with MIT License 4 votes vote down vote up
public void printTo(
        Writer out, long instant, Chronology chrono,
        int displayOffset, DateTimeZone displayZone, Locale locale) throws IOException {
    if (displayZone == null) {
        return;  // no zone
    }
    if (displayOffset == 0 && iZeroOffsetPrintText != null) {
        out.write(iZeroOffsetPrintText);
        return;
    }
    if (displayOffset >= 0) {
        out.write('+');
    } else {
        out.write('-');
        displayOffset = -displayOffset;
    }

    int hours = displayOffset / DateTimeConstants.MILLIS_PER_HOUR;
    FormatUtils.writePaddedInteger(out, hours, 2);
    if (iMaxFields == 1) {
        return;
    }
    displayOffset -= hours * (int)DateTimeConstants.MILLIS_PER_HOUR;
    if (displayOffset == 0 && iMinFields == 1) {
        return;
    }

    int minutes = displayOffset / DateTimeConstants.MILLIS_PER_MINUTE;
    if (iShowSeparators) {
        out.write(':');
    }
    FormatUtils.writePaddedInteger(out, minutes, 2);
    if (iMaxFields == 2) {
        return;
    }
    displayOffset -= minutes * DateTimeConstants.MILLIS_PER_MINUTE;
    if (displayOffset == 0 && iMinFields == 2) {
        return;
    }

    int seconds = displayOffset / DateTimeConstants.MILLIS_PER_SECOND;
    if (iShowSeparators) {
        out.write(':');
    }
    FormatUtils.writePaddedInteger(out, seconds, 2);
    if (iMaxFields == 3) {
        return;
    }
    displayOffset -= seconds * DateTimeConstants.MILLIS_PER_SECOND;
    if (displayOffset == 0 && iMinFields == 3) {
        return;
    }

    if (iShowSeparators) {
        out.write('.');
    }
    FormatUtils.writePaddedInteger(out, displayOffset, 3);
}
 
Example 11
Source File: DateTimeFormatterBuilder.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
public void printTo(
        StringBuffer buf, long instant, Chronology chrono,
        int displayOffset, DateTimeZone displayZone, Locale locale) {
    if (displayZone == null) {
        return;  // no zone
    }
    if (displayOffset == 0 && iZeroOffsetPrintText != null) {
        buf.append(iZeroOffsetPrintText);
        return;
    }
    if (displayOffset >= 0) {
        buf.append('+');
    } else {
        buf.append('-');
        displayOffset = -displayOffset;
    }

    int hours = displayOffset / DateTimeConstants.MILLIS_PER_HOUR;
    FormatUtils.appendPaddedInteger(buf, hours, 2);
    if (iMaxFields == 1) {
        return;
    }
    displayOffset -= hours * (int)DateTimeConstants.MILLIS_PER_HOUR;
    if (displayOffset == 0 && iMinFields <= 1) {
        return;
    }

    int minutes = displayOffset / DateTimeConstants.MILLIS_PER_MINUTE;
    if (iShowSeparators) {
        buf.append(':');
    }
    FormatUtils.appendPaddedInteger(buf, minutes, 2);
    if (iMaxFields == 2) {
        return;
    }
    displayOffset -= minutes * DateTimeConstants.MILLIS_PER_MINUTE;
    if (displayOffset == 0 && iMinFields <= 2) {
        return;
    }

    int seconds = displayOffset / DateTimeConstants.MILLIS_PER_SECOND;
    if (iShowSeparators) {
        buf.append(':');
    }
    FormatUtils.appendPaddedInteger(buf, seconds, 2);
    if (iMaxFields == 3) {
        return;
    }
    displayOffset -= seconds * DateTimeConstants.MILLIS_PER_SECOND;
    if (displayOffset == 0 && iMinFields <= 3) {
        return;
    }

    if (iShowSeparators) {
        buf.append('.');
    }
    FormatUtils.appendPaddedInteger(buf, displayOffset, 3);
}
 
Example 12
Source File: DateTimeFormatterBuilder.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
public void printTo(
        Writer out, long instant, Chronology chrono,
        int displayOffset, DateTimeZone displayZone, Locale locale) throws IOException {
    if (displayZone == null) {
        return;  // no zone
    }
    if (displayOffset == 0 && iZeroOffsetPrintText != null) {
        out.write(iZeroOffsetPrintText);
        return;
    }
    if (displayOffset >= 0) {
        out.write('+');
    } else {
        out.write('-');
        displayOffset = -displayOffset;
    }

    int hours = displayOffset / DateTimeConstants.MILLIS_PER_HOUR;
    FormatUtils.writePaddedInteger(out, hours, 2);
    if (iMaxFields == 1) {
        return;
    }
    displayOffset -= hours * (int)DateTimeConstants.MILLIS_PER_HOUR;
    if (displayOffset == 0 && iMinFields == 1) {
        return;
    }

    int minutes = displayOffset / DateTimeConstants.MILLIS_PER_MINUTE;
    if (iShowSeparators) {
        out.write(':');
    }
    FormatUtils.writePaddedInteger(out, minutes, 2);
    if (iMaxFields == 2) {
        return;
    }
    displayOffset -= minutes * DateTimeConstants.MILLIS_PER_MINUTE;
    if (displayOffset == 0 && iMinFields == 2) {
        return;
    }

    int seconds = displayOffset / DateTimeConstants.MILLIS_PER_SECOND;
    if (iShowSeparators) {
        out.write(':');
    }
    FormatUtils.writePaddedInteger(out, seconds, 2);
    if (iMaxFields == 3) {
        return;
    }
    displayOffset -= seconds * DateTimeConstants.MILLIS_PER_SECOND;
    if (displayOffset == 0 && iMinFields == 3) {
        return;
    }

    if (iShowSeparators) {
        out.write('.');
    }
    FormatUtils.writePaddedInteger(out, displayOffset, 3);
}
 
Example 13
Source File: DateTimeFormatterBuilder.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
public void printTo(
        StringBuffer buf, long instant, Chronology chrono,
        int displayOffset, DateTimeZone displayZone, Locale locale) {
    if (displayZone == null) {
        return;  // no zone
    }
    if (displayOffset == 0 && iZeroOffsetPrintText != null) {
        buf.append(iZeroOffsetPrintText);
        return;
    }
    if (displayOffset >= 0) {
        buf.append('+');
    } else {
        buf.append('-');
        displayOffset = -displayOffset;
    }

    int hours = displayOffset / DateTimeConstants.MILLIS_PER_HOUR;
    FormatUtils.appendPaddedInteger(buf, hours, 2);
    if (iMaxFields == 1) {
        return;
    }
    displayOffset -= hours * (int)DateTimeConstants.MILLIS_PER_HOUR;
    if (displayOffset == 0 && iMinFields <= 1) {
        return;
    }

    int minutes = displayOffset / DateTimeConstants.MILLIS_PER_MINUTE;
    if (iShowSeparators) {
        buf.append(':');
    }
    FormatUtils.appendPaddedInteger(buf, minutes, 2);
    if (iMaxFields == 2) {
        return;
    }
    displayOffset -= minutes * DateTimeConstants.MILLIS_PER_MINUTE;
    if (displayOffset == 0 && iMinFields <= 2) {
        return;
    }

    int seconds = displayOffset / DateTimeConstants.MILLIS_PER_SECOND;
    if (iShowSeparators) {
        buf.append(':');
    }
    FormatUtils.appendPaddedInteger(buf, seconds, 2);
    if (iMaxFields == 3) {
        return;
    }
    displayOffset -= seconds * DateTimeConstants.MILLIS_PER_SECOND;
    if (displayOffset == 0 && iMinFields <= 3) {
        return;
    }

    if (iShowSeparators) {
        buf.append('.');
    }
    FormatUtils.appendPaddedInteger(buf, displayOffset, 3);
}
 
Example 14
Source File: DateTimeFormatterBuilder.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
public void printTo(
        Writer out, long instant, Chronology chrono,
        int displayOffset, DateTimeZone displayZone, Locale locale) throws IOException {
    if (displayZone == null) {
        return;  // no zone
    }
    if (displayOffset == 0 && iZeroOffsetPrintText != null) {
        out.write(iZeroOffsetPrintText);
        return;
    }
    if (displayOffset >= 0) {
        out.write('+');
    } else {
        out.write('-');
        displayOffset = -displayOffset;
    }

    int hours = displayOffset / DateTimeConstants.MILLIS_PER_HOUR;
    FormatUtils.writePaddedInteger(out, hours, 2);
    if (iMaxFields == 1) {
        return;
    }
    displayOffset -= hours * (int)DateTimeConstants.MILLIS_PER_HOUR;
    if (displayOffset == 0 && iMinFields == 1) {
        return;
    }

    int minutes = displayOffset / DateTimeConstants.MILLIS_PER_MINUTE;
    if (iShowSeparators) {
        out.write(':');
    }
    FormatUtils.writePaddedInteger(out, minutes, 2);
    if (iMaxFields == 2) {
        return;
    }
    displayOffset -= minutes * DateTimeConstants.MILLIS_PER_MINUTE;
    if (displayOffset == 0 && iMinFields == 2) {
        return;
    }

    int seconds = displayOffset / DateTimeConstants.MILLIS_PER_SECOND;
    if (iShowSeparators) {
        out.write(':');
    }
    FormatUtils.writePaddedInteger(out, seconds, 2);
    if (iMaxFields == 3) {
        return;
    }
    displayOffset -= seconds * DateTimeConstants.MILLIS_PER_SECOND;
    if (displayOffset == 0 && iMinFields == 3) {
        return;
    }

    if (iShowSeparators) {
        out.write('.');
    }
    FormatUtils.writePaddedInteger(out, displayOffset, 3);
}