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


Java Duration.ofMinutes方法代码示例

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


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

示例1: apply

import org.threeten.bp.Duration; //导入方法依赖的package包/类
@Override
public ExerciseSession apply(@javax.annotation.Nullable UserEventRecord exerciseSession) {
  checkNotNull(exerciseSession, "exerciseSession should be non-null");
  checkArgument(exerciseSession.getEventType() == EXERCISE);

  Instant internalTimeUTC =
      DEXCOM_SYSTEM_TIME_TO_INSTANT.apply(exerciseSession.getInternalSecondsSinceDexcomEpoch());
  LocalDateTime localRecordedTime =
      DEXCOM_DISPLAY_TIME_TO_LOCAL_DATE_TIME.apply(exerciseSession.getLocalSecondsSinceDexcomEpoch());
  LocalDateTime eventLocalTime =
      DEXCOM_DISPLAY_TIME_TO_LOCAL_DATE_TIME.apply(exerciseSession.getEventSecondsSinceDexcomEpoch());

  long duration = exerciseSession.getEventValue();

  UserEventRecord.ExerciseIntensity exerciseIntensity =
      UserEventRecord.ExerciseIntensity.fromId(exerciseSession.getEventSubType());
  ExerciseSession.Intensity intensity =
      DEXCOM_EXERCISE_INTENSITY_TO_INTENSITY.apply(exerciseIntensity);

  return new ExerciseSession(internalTimeUTC, localRecordedTime, eventLocalTime,
      intensity, Duration.ofMinutes(duration), EMPTY_DESCRIPTION);
}
 
开发者ID:alexandre-normand,项目名称:blood-shepherd,代码行数:23,代码来源:DexcomAdapterService.java

示例2: exerciseUserRecordShouldBeConverted

import org.threeten.bp.Duration; //导入方法依赖的package包/类
@Test
public void exerciseUserRecordShouldBeConverted() throws Exception {
  DexcomAdapterService dexcomAdapterService = new DexcomAdapterService();

  SyncData syncData = dexcomAdapterService.convertData(
      new DexcomSyncData(EMPTY_GLUCOSE_READ_RECORDS,
          Arrays.asList(new UserEventRecord(1000L, 2000L, 1500L, UserEventRecord.UserEventType.EXERCISE,
              UserEventRecord.ExerciseIntensity.LIGHT.getId(), 10)),
          new ManufacturingParameters(SERIAL_NUMBER, "partNumber", HARDWARE_REVISION, "2013-10-18 10:10", HARDWARE_ID),
              TEST_TIME));

  ExerciseSession expectedExerciseSession = new ExerciseSession(internalTimeFromSeconds(1000L),
      localDateTimeFromSeconds(2000L), localDateTimeFromSeconds(1500L), ExerciseSession.Intensity.LIGHT,
      Duration.ofMinutes(10), ExerciseSession.EMPTY_DESCRIPTION);
  SyncData expectedSyncData = new SyncData(EMPTY_GLUCOSE_READS, EMPTY_INSULIN_INJECTIONS, EMPTY_FOOD_EVENTS,
      Arrays.asList(expectedExerciseSession), new DeviceInfo(SERIAL_NUMBER, HARDWARE_ID, HARDWARE_REVISION),
          TEST_TIME);

  assertThat(syncData, is(equalTo(expectedSyncData)));
}
 
开发者ID:alexandre-normand,项目名称:blood-shepherd,代码行数:21,代码来源:TestDexcomAdapterService.java

示例3: everyMinutes

import org.threeten.bp.Duration; //导入方法依赖的package包/类
/**
 * Create a schedule builder where events are triggered every {@code minutes}
 *
 * @param hours the number of minutes between events
 * @return a schedule builder generating events every {@code minutes}
 * @throws IllegalArgumentException if {@code minutes} is negative
 */
public static Builder everyMinutes(long minutes) {
  return new Builder(Duration.ofMinutes(minutes));
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:11,代码来源:Schedule.java


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