本文整理汇总了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));
}
示例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());
}
示例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);
}
示例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);
}
示例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());
}
示例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);
}
示例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());
}
示例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());
}
示例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());
}
示例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);
}
示例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());
}
示例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());
}
示例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);
}
示例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());
}
示例15: apply
import org.threeten.bp.Instant; //导入方法依赖的package包/类
@Override
public Instant apply(FromDecimalArguments a) {
return Instant.ofEpochSecond(a.integer, a.fraction);
}