java.time.LocalTime.minusNanos()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(1.5k)|赞(0)|评价(0)|浏览(122)

本文整理了Java中java.time.LocalTime.minusNanos()方法的一些代码示例,展示了LocalTime.minusNanos()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LocalTime.minusNanos()方法的具体详情如下:
包路径:java.time.LocalTime
类名称:LocalTime
方法名:minusNanos

LocalTime.minusNanos介绍

[英]Returns a copy of this LocalTime with the specified period in nanoseconds subtracted.

This subtracts the specified number of nanoseconds from this time, returning a new time. The calculation wraps around midnight.

This instance is immutable and unaffected by this method call.
[中]返回此LocalTime的副本,并减去指定的时间段(以纳秒为单位)。
这将从该时间减去指定的纳秒数,返回一个新时间。计算时间大约在午夜。
此实例是不可变的,不受此方法调用的影响。

代码示例

代码示例来源:origin: neo4j/neo4j

@Override
public LocalTimeValue sub( DurationValue duration )
{
  return replacement( assertValidArithmetic( () -> value.minusNanos( duration.nanosOfDay() ) ) );
}

代码示例来源:origin: com.github.seratch/java-time-backport

/**
 * Returns a copy of this {@code OffsetTime} with the specified period in nanoseconds subtracted.
 * <p>
 * This subtracts the specified number of nanoseconds from this time, returning a new time.
 * The calculation wraps around midnight.
 * <p>
 * This instance is immutable and unaffected by this method call.
 *
 * @param nanos  the nanos to subtract, may be negative
 * @return an {@code OffsetTime} based on this time with the nanoseconds subtracted, not null
 */
public OffsetTime minusNanos(long nanos) {
  return with(time.minusNanos(nanos), offset);
}

代码示例来源:origin: org.neo4j/neo4j-values

@Override
public LocalTimeValue sub( DurationValue duration )
{
  return replacement( assertValidArithmetic( () -> value.minusNanos( duration.nanosOfDay() ) ) );
}

相关文章