当前位置: 首页>>代码示例>>Java>>正文


Java DateTimeConstants.MILLIS_PER_MINUTE属性代码示例

本文整理汇总了Java中org.joda.time.DateTimeConstants.MILLIS_PER_MINUTE属性的典型用法代码示例。如果您正苦于以下问题:Java DateTimeConstants.MILLIS_PER_MINUTE属性的具体用法?Java DateTimeConstants.MILLIS_PER_MINUTE怎么用?Java DateTimeConstants.MILLIS_PER_MINUTE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.joda.time.DateTimeConstants的用法示例。


在下文中一共展示了DateTimeConstants.MILLIS_PER_MINUTE属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: millisPerUnit

private static int millisPerUnit(String unit) {
  switch (Ascii.toLowerCase(unit)) {
    case "d":
      return DateTimeConstants.MILLIS_PER_DAY;
    case "h":
      return DateTimeConstants.MILLIS_PER_HOUR;
    case "m":
      return DateTimeConstants.MILLIS_PER_MINUTE;
    case "s":
      return DateTimeConstants.MILLIS_PER_SECOND;
    case "ms":
      return 1;
    default:
      throw new IllegalArgumentException("Unknown duration unit " + unit);
  }
}
 
开发者ID:GoogleCloudPlatform,项目名称:pubsub,代码行数:16,代码来源:Driver.java

示例2: getDateTimeMillis

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;
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:21,代码来源:BasicChronology.java

示例3: shareScheduledMessages

@Scheduled(fixedRate=DateTimeConstants.MILLIS_PER_MINUTE)
@SqlTransactional
public void shareScheduledMessages() {
    while (true) {
        if (queue.isEmpty()) {
            break;
        }
        DateTime messageTime = queue.peek().getScheduledTime();
        // send messages whose time is before the current moment. This job runs every minute,
        // so the maximum delay for a message will be 1 minute
        if (messageTime.isBeforeNow()) {
            ScheduledMessage msg = queue.poll();
            shareService.share(msg.getText(),
                    msg.getUserId(),
                    Arrays.asList(StringUtils.split(msg.getPictureUrls(), DELIMITER)),
                    Arrays.asList(StringUtils.split(msg.getExternalSites(), DELIMITER)),
                    Arrays.asList(StringUtils.split(msg.getHideFromUsernames(), DELIMITER)),
                    msg.isHideFromCloseFriends());

            shareService.delete(msg);
        } else {
            break;
        }
    }
}
 
开发者ID:Glamdring,项目名称:welshare,代码行数:25,代码来源:ScheduledMessagesJob.java

示例4: printTo

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);
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:58,代码来源:DateTimeFormatterBuilder.java


注:本文中的org.joda.time.DateTimeConstants.MILLIS_PER_MINUTE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。