本文整理了Java中org.apache.brooklyn.util.time.Time.dropMilliseconds()
方法的一些代码示例,展示了Time.dropMilliseconds()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Time.dropMilliseconds()
方法的具体详情如下:
包路径:org.apache.brooklyn.util.time.Time
类名称:Time
方法名:dropMilliseconds
[英]removes milliseconds from the date object; needed if serializing to ISO-8601 format and want to serialize back and get the same data
[中]从日期对象中移除毫秒;如果序列化为ISO-8601格式并希望序列化回来并获得相同的数据,则需要
代码示例来源:origin: org.apache.brooklyn.camp/camp-base
private void setCreated(Date created) {
// precision beyond seconds breaks equals check
this.created = Time.dropMilliseconds(created);
}
private void setTags(List<String> tags) {
代码示例来源:origin: org.apache.brooklyn/brooklyn-utils-common
@Test
public void testDateRoundingNull() {
Assert.assertNull(Time.dropMilliseconds(null));
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-utils-common
@Test
public void testDateRounding() {
long x = System.currentTimeMillis();
Date d1 = Time.dropMilliseconds(new Date(x));
Date d2 = new Date(x - (x%1000));
Date d3 = new Date( (x/1000)*1000 );
Assert.assertEquals(d1.getTime() % 1000, 0);
Assert.assertEquals(d1, d2);
Assert.assertEquals(d1, d3);
}
内容来源于网络,如有侵权,请联系作者删除!