博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
clock.tick_Java Clock类| tick()方法与示例
阅读量:2537 次
发布时间:2019-05-11

本文共 2636 字,大约阅读时间需要 8 分钟。

clock.tick

Clock Class tick()方法 (Clock Class tick() method)

  • tick() method is available in java.time package.

    tick()方法在java.time包中可用。

  • tick() method is used to get a Clock that returns the current instant tick the given base clock (base_cl) discarded to the close occurrence of the given duration (time_du).

    tick()方法用于获取一个Clock,该Clock返回丢弃给定持续时间(time_du)的给定基本时钟(base_cl)的当前瞬间滴答。

  • tick() method is a static method, it is accessible with the class name and if we try to access the method with the class object then we will not get an error.

    tick()方法是静态方法,可以使用类名进行访问,如果尝试使用类对象访问该方法,则不会收到错误。

  • tick() method does not throw an exception at the time of representing Clock.

    tick()方法在表示Clock时不会引发异常。

Syntax:

句法:

public static Clock tick(Clock base_cl, Duration time_du);

Parameter(s):

参数:

  • Clock base_cl – represents the base clock in which to add to the given duration.

    Clock base_cl –表示要添加到给定持续时间的基本时钟。

  • Duration time_du – represents the duration in which to add the given clock.

    持续时间time_du –表示添加给定时钟的持续时间。

Return value:

返回值:

The return type of this method is Clock, it returns Clock that ticks in entire units of the given duration.

此方法的返回类型为Clock ,它返回Clock ,该Clock在给定持续时间的整个单位内滴答。

Example:

例:

// Java program to demonstrate the example // of tick(Clock base_cl, Duration time_du) method of Clockimport java.time.*;public class TickOfClock {
public static void main(String args[]) {
// Instantiates two ZoneId for Accra and Asmara ZoneId zone_1 = ZoneId.of("Africa/Accra"); ZoneId zone_2 = ZoneId.of("Africa/Asmara"); // Initialize two Clock objects // and one Duration Clock cl1 = Clock.system(zone_1); Clock cl2 = Clock.system(zone_2); Duration offset = Duration.ofNanos(20000); // generates a new Clock from the // given clock(cl1) with the given duration // truncated Clock cl_tick = cl1.tick(cl1, offset); // Display cl1 and cl_tick instant System.out.println("cl1.instant(): " + cl1.instant()); System.out.println("cl_tick.instant(): " + cl_tick.instant()); System.out.println(); // generates a new Clock from the // given clock(cl2) with the given duration // truncated cl_tick = cl2.tick(cl2, offset); // Display cl2 and cl_tick instant System.out.println("cl2.instant(): " + cl2.instant()); System.out.println("cl_tick.instant(): " + cl_tick.instant()); }}

Output

输出量

cl1.instant(): 2020-05-13T21:43:13.551129Zcl_tick.instant(): 2020-05-13T21:43:13.598720Zcl2.instant(): 2020-05-13T21:43:13.599785Zcl_tick.instant(): 2020-05-13T21:43:13.600620Z

翻译自:

clock.tick

转载地址:http://swozd.baihongyu.com/

你可能感兴趣的文章
ultraedit激活
查看>>
总结(6)--- python基础知识点小结(细全)
查看>>
亿级曝光品牌视频的幕后设定
查看>>
ARPA
查看>>
JSP开发模式
查看>>
我的Android进阶之旅------>Android嵌入图像InsetDrawable的使用方法
查看>>
Detours信息泄漏漏洞
查看>>
win32使用拖放文件
查看>>
Android 动态显示和隐藏软键盘
查看>>
raid5什么意思?怎样做raid5?raid5 几块硬盘?
查看>>
【转】how can i build fast
查看>>
null?对象?异常?到底应该如何返回错误信息
查看>>
django登录验证码操作
查看>>
(简单)华为Nova青春 WAS-AL00的USB调试模式在哪里开启的流程
查看>>
图论知识,博客
查看>>
[原创]一篇无关技术的小日记(仅作暂存)
查看>>
20145303刘俊谦 Exp7 网络欺诈技术防范
查看>>
原生和jQuery的ajax用法
查看>>
iOS开发播放文本
查看>>
20145202马超《java》实验5
查看>>