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


Java Instant.ofEpochSecond方法代码示例

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


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

示例1: setupBuildSection

import org.threeten.bp.Instant; //导入方法依赖的package包/类
private void setupBuildSection() {
  buildNameView.setText(BuildConfig.VERSION_NAME);
  buildCodeView.setText(String.valueOf(BuildConfig.VERSION_CODE));
  buildShaView.setText(BuildConfig.GIT_SHA);

  TemporalAccessor buildTime = Instant.ofEpochSecond(BuildConfig.GIT_TIMESTAMP);
  buildDateView.setText(DATE_DISPLAY_FORMAT.format(buildTime));
}
 
开发者ID:rogues-dev,项目名称:superglue,代码行数:9,代码来源:DebugView.java

示例2: test_builder_put_LD

import org.threeten.bp.Instant; //导入方法依赖的package包/类
public void test_builder_put_LD() {
  InstantDoubleTimeSeriesBuilder bld = ImmutableInstantDoubleTimeSeries.builder();
  bld.put(Instant.ofEpochSecond(2222), 2.0).put(Instant.ofEpochSecond(3333), 3.0).put(Instant.ofEpochSecond(1111), 1.0);
  Instant[] outDates = new Instant[] {Instant.ofEpochSecond(1111), Instant.ofEpochSecond(2222), Instant.ofEpochSecond(3333)};
  double[] outValues = new double[] {1.0, 2.0, 3.0};
  assertEquals(ImmutableInstantDoubleTimeSeries.of(outDates, outValues), bld.build());
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:8,代码来源:ImmutableInstantDoubleTimeSeriesTest.java

示例3: convertToInstant

import org.threeten.bp.Instant; //导入方法依赖的package包/类
/**
 * Converts a {@code long} to an {@code Instant}.
 * <p>
 * See the class Javadoc for the format of the {@code long}.
 * 
 * @param instant  the {@code long} nanos to convert, not null
 * @return the {@code Instant} equivalent, not null
 */
public static Instant convertToInstant(long instant) {
  if (instant == Long.MAX_VALUE) {
    return Instant.MAX;
  }
  if (instant == Long.MIN_VALUE) {
    return Instant.MIN;
  }
  return Instant.ofEpochSecond(0, instant);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:18,代码来源:InstantToLongConverter.java

示例4: test_of_InstantArray_valueArray

import org.threeten.bp.Instant; //导入方法依赖的package包/类
public void test_of_InstantArray_valueArray() {
  Instant[] inDates = new Instant[] {Instant.ofEpochSecond(2222), Instant.ofEpochSecond(3333)};
  Float[] inValues = new Float[] {2.0f, 3.0f};
  InstantObjectTimeSeries<Float> ts= ImmutableInstantObjectTimeSeries.of(inDates, inValues);
  assertEquals(ts.size(), 2);
  assertEquals(ts.getTimeAtIndex(0), Instant.ofEpochSecond(2222));
  assertEquals(ts.getValueAtIndex(0), 2.0f);
  assertEquals(ts.getTimeAtIndex(1), Instant.ofEpochSecond(3333));
  assertEquals(ts.getValueAtIndex(1), 3.0f);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:11,代码来源:ImmutableInstantObjectTimeSeriesTest.java

示例5: test_iterator_removeFirst

import org.threeten.bp.Instant; //导入方法依赖的package包/类
public void test_iterator_removeFirst() {
  InstantObjectTimeSeriesBuilder<Float> bld = ImmutableInstantObjectTimeSeries.builder();
  bld.put(Instant.ofEpochSecond(2222), 2.0f).put(Instant.ofEpochSecond(3333), 3.0f).put(Instant.ofEpochSecond(1111), 1.0f);
  InstantObjectEntryIterator<Float> it = bld.iterator();
  it.next();
  it.remove();
  assertEquals(2, bld.size());
  Instant[] outDates = new Instant[] {Instant.ofEpochSecond(2222), Instant.ofEpochSecond(3333)};
  Float[] outValues = new Float[] {2.0f, 3.0f};
  assertEquals(ImmutableInstantObjectTimeSeries.of(outDates, outValues), bld.build());
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:12,代码来源:ImmutableInstantObjectTimeSeriesTest.java

示例6: test_builder_putAll_Instant_mismatchedArrays

import org.threeten.bp.Instant; //导入方法依赖的package包/类
@Test(expectedExceptions = IllegalArgumentException.class)
public void test_builder_putAll_Instant_mismatchedArrays() {
  InstantDoubleTimeSeriesBuilder bld = ImmutableInstantDoubleTimeSeries.builder();
  Instant[] inDates = new Instant[] {Instant.ofEpochSecond(2222), Instant.ofEpochSecond(3333)};
  double[] inValues = new double[] {2.0, 3.0, 1.0};
  bld.putAll(inDates, inValues);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:8,代码来源:ImmutableInstantDoubleTimeSeriesTest.java

示例7: test_builder_put_LD

import org.threeten.bp.Instant; //导入方法依赖的package包/类
public void test_builder_put_LD() {
  InstantObjectTimeSeriesBuilder<Float> bld = ImmutableInstantObjectTimeSeries.builder();
  bld.put(Instant.ofEpochSecond(2222), 2.0f).put(Instant.ofEpochSecond(3333), 3.0f).put(Instant.ofEpochSecond(1111), 1.0f);
  Instant[] outDates = new Instant[] {Instant.ofEpochSecond(1111), Instant.ofEpochSecond(2222), Instant.ofEpochSecond(3333)};
  Float[] outValues = new Float[] {1.0f, 2.0f, 3.0f};
  assertEquals(ImmutableInstantObjectTimeSeries.of(outDates, outValues), bld.build());
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:8,代码来源:ImmutableInstantObjectTimeSeriesTest.java

示例8: test_builder_put_Instant_alreadyThere

import org.threeten.bp.Instant; //导入方法依赖的package包/类
public void test_builder_put_Instant_alreadyThere() {
  InstantObjectTimeSeriesBuilder<Float> bld = ImmutableInstantObjectTimeSeries.builder();
  bld.put(Instant.ofEpochSecond(2222), 2.0f).put(Instant.ofEpochSecond(3333), 3.0f).put(Instant.ofEpochSecond(2222), 1.0f);
  Instant[] outDates = new Instant[] {Instant.ofEpochSecond(2222), Instant.ofEpochSecond(3333)};
  Float[] outValues = new Float[] {1.0f, 3.0f};
  assertEquals(ImmutableInstantObjectTimeSeries.of(outDates, outValues), bld.build());
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:8,代码来源:ImmutableInstantObjectTimeSeriesTest.java

示例9: test_builder_put_Instant_alreadyThere

import org.threeten.bp.Instant; //导入方法依赖的package包/类
public void test_builder_put_Instant_alreadyThere() {
  InstantDoubleTimeSeriesBuilder bld = ImmutableInstantDoubleTimeSeries.builder();
  bld.put(Instant.ofEpochSecond(2222), 2.0).put(Instant.ofEpochSecond(3333), 3.0).put(Instant.ofEpochSecond(2222), 1.0);
  Instant[] outDates = new Instant[] {Instant.ofEpochSecond(2222), Instant.ofEpochSecond(3333)};
  double[] outValues = new double[] {1.0, 3.0};
  assertEquals(ImmutableInstantDoubleTimeSeries.of(outDates, outValues), bld.build());
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:8,代码来源:ImmutableInstantDoubleTimeSeriesTest.java

示例10: test_builder_putAll_Instant_mismatchedArrays

import org.threeten.bp.Instant; //导入方法依赖的package包/类
@Test(expectedExceptions = IllegalArgumentException.class)
public void test_builder_putAll_Instant_mismatchedArrays() {
  InstantObjectTimeSeriesBuilder<Float> bld = ImmutableInstantObjectTimeSeries.builder();
  Instant[] inDates = new Instant[] {Instant.ofEpochSecond(2222), Instant.ofEpochSecond(3333)};
  Float[] inValues = new Float[] {2.0f, 3.0f, 1.0f};
  bld.putAll(inDates, inValues);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:8,代码来源:ImmutableInstantObjectTimeSeriesTest.java

示例11: test_builder_putAll_Map

import org.threeten.bp.Instant; //导入方法依赖的package包/类
public void test_builder_putAll_Map() {
  InstantObjectTimeSeriesBuilder<Float> bld = ImmutableInstantObjectTimeSeries.builder();
  Map<Instant, Float> map = new HashMap<>();
  map.put(Instant.ofEpochSecond(2222), 2.0f);
  map.put(Instant.ofEpochSecond(3333), 3.0f);
  map.put(Instant.ofEpochSecond(1111), 1.0f);
  bld.putAll(map);
  Instant[] outDates = new Instant[] {Instant.ofEpochSecond(1111), Instant.ofEpochSecond(2222), Instant.ofEpochSecond(3333)};
  Float[] outValues = new Float[] {1.0f, 2.0f, 3.0f};
  assertEquals(ImmutableInstantObjectTimeSeries.of(outDates, outValues), bld.build());
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:12,代码来源:ImmutableInstantObjectTimeSeriesTest.java

示例12: test_iterator_removeFirst

import org.threeten.bp.Instant; //导入方法依赖的package包/类
public void test_iterator_removeFirst() {
  InstantDoubleTimeSeriesBuilder bld = ImmutableInstantDoubleTimeSeries.builder();
  bld.put(Instant.ofEpochSecond(2222), 2.0).put(Instant.ofEpochSecond(3333), 3.0).put(Instant.ofEpochSecond(1111), 1.0);
  InstantDoubleEntryIterator it = bld.iterator();
  it.next();
  it.remove();
  assertEquals(2, bld.size());
  Instant[] outDates = new Instant[] {Instant.ofEpochSecond(2222), Instant.ofEpochSecond(3333)};
  double[] outValues = new double[] {2.0, 3.0};
  assertEquals(ImmutableInstantDoubleTimeSeries.of(outDates, outValues), bld.build());
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:12,代码来源:ImmutableInstantDoubleTimeSeriesTest.java

示例13: test_of_InstantArray_DoubleArray

import org.threeten.bp.Instant; //导入方法依赖的package包/类
public void test_of_InstantArray_DoubleArray() {
  Instant[] inDates = new Instant[] {Instant.ofEpochSecond(2222), Instant.ofEpochSecond(3333)};
  Double[] inValues = new Double[] {2.0, 3.0};
  InstantDoubleTimeSeries ts= ImmutableInstantDoubleTimeSeries.of(inDates, inValues);
  assertEquals(ts.size(), 2);
  assertEquals(ts.getTimeAtIndex(0), Instant.ofEpochSecond(2222));
  assertEquals(ts.getValueAtIndex(0), 2.0);
  assertEquals(ts.getTimeAtIndex(1), Instant.ofEpochSecond(3333));
  assertEquals(ts.getValueAtIndex(1), 3.0);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:11,代码来源:ImmutableInstantDoubleTimeSeriesTest.java

示例14: test_iterator_removeMid

import org.threeten.bp.Instant; //导入方法依赖的package包/类
public void test_iterator_removeMid() {
  InstantDoubleTimeSeriesBuilder bld = ImmutableInstantDoubleTimeSeries.builder();
  bld.put(Instant.ofEpochSecond(2222), 2.0).put(Instant.ofEpochSecond(3333), 3.0).put(Instant.ofEpochSecond(1111), 1.0);
  InstantDoubleEntryIterator it = bld.iterator();
  it.next();
  it.next();
  it.remove();
  assertEquals(2, bld.size());
  Instant[] outDates = new Instant[] {Instant.ofEpochSecond(1111), Instant.ofEpochSecond(3333)};
  double[] outValues = new double[] {1.0, 3.0};
  assertEquals(ImmutableInstantDoubleTimeSeries.of(outDates, outValues), bld.build());
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:13,代码来源:ImmutableInstantDoubleTimeSeriesTest.java

示例15: apply

import org.threeten.bp.Instant; //导入方法依赖的package包/类
@Override
public Instant apply(FromDecimalArguments a) {
  return Instant.ofEpochSecond(a.integer, a.fraction);
}
 
开发者ID:cliffano,项目名称:swaggy-jenkins,代码行数:5,代码来源:CustomInstantDeserializer.java


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