nanosecond
pub fn nanosecond() int用途
nanosecond,返回 int。
参数
无
返回
int — 该类型的值
API
#timeDuration 为纳秒 int。now/sleep、Time、Timer/Ticker(xu+chan+sleep)。无 IANA 时区。
nanosecondpub fn nanosecond() intnanosecond,返回 int。
无
int — 该类型的值
microsecondpub fn microsecond() intmicrosecond,返回 int。
无
int — 该类型的值
millisecondpub fn millisecond() intmillisecond,返回 int。
无
int — 该类型的值
secondpub fn second() int秒。
无
int — 该类型的值
minutepub fn minute() int分。
无
int — 该类型的值
hourpub fn hour() int时。
无
int — 该类型的值
nowpub fn now() int当前时间。
无
int — 该类型的值
sleeppub fn sleep(d int)阻塞等待一段时间。
d intsincepub fn since(t int) int以来。
t intint — 该类型的值
struct Timepub struct Time {
pub sec int
pub nsec int
}公开结构体 `Time`。
sec intnsec intunixpub fn unix(sec int, nsec int) TimeUnix 时间。
sec intnsec intTime — 该类型的值
unix_from_nspub fn unix_from_ns(ns int) TimeUnix 时间从ns。
ns intTime — 该类型的值
(Time) unixpub fn (t Time) unix() int`Time` 上的方法:Unix 时间。
t Timeint — 该类型的值
(Time) is_zeropub fn (t Time) is_zero() bool`Time` 上的方法:判断是否 zero。
t Timebool — 是否成立
(Time) unix_nanopub fn (t Time) unix_nano() int`Time` 上的方法:Unix 时间nano。
t Timeint — 该类型的值
(Time) unix_millipub fn (t Time) unix_milli() int`Time` 上的方法:Unix 时间milli。
t Timeint — 该类型的值
(Time) unix_micropub fn (t Time) unix_micro() int`Time` 上的方法:Unix 时间micro。
t Timeint — 该类型的值
unix_millipub fn unix_milli(ms int) TimeUnix 时间milli。
ms intTime — 该类型的值
unix_micropub fn unix_micro(us int) TimeUnix 时间micro。
us intTime — 该类型的值
(Time) addpub fn (t Time) add(d int) Time`Time` 上的方法:相加。
t Timed intTime — 该类型的值
(Time) subpub fn (t Time) sub(u Time) int`Time` 上的方法:相减。
t Timeu Timeint — 该类型的值
(Time) beforepub fn (t Time) before(u Time) bool在 `Time` 上调用 `before`。
t Timeu Timebool — 是否成立
(Time) afterpub fn (t Time) after(u Time) bool在 `Time` 上调用 `after`。
t Timeu Timebool — 是否成立
(Time) equalpub fn (t Time) equal(u Time) bool`Time` 上的方法:判断两值是否相等。
t Timeu Timebool — 是否成立
now_timepub fn now_time() Time当前时间time。
无
Time — 该类型的值
parse_durationpub fn parse_duration(s &string) int解析为 duration。失败时 throw。
s &stringint — 该类型的值
format_durationpub fn format_duration(d int) string格式化为 duration。
d intstring — 结果字符串
(Time) format_rfc3339pub fn (t Time) format_rfc3339() string`Time` 上的方法:格式化为 rfc3339。
t Timestring — 结果字符串
(Time) format_logpub fn (t Time) format_log(date int, tod int, micro int) string`Time` 上的方法:格式化为 log。
t Timedate inttod intmicro intstring — 结果字符串
parse_rfc3339pub fn parse_rfc3339(s &string) Time解析为 rfc3339。失败时 throw。
s &stringTime — 该类型的值
(Time) add_datepub fn (t Time) add_date(years int, months int, days int) Time`Time` 上的方法:增加日期。
t Timeyears intmonths intdays intTime — 该类型的值
datepub fn date(year int, month int, day int, hour int, min int, sec int, nsec int) Time日期。
year intmonth intday inthour intmin intsec intnsec intTime — 该类型的值
(Time) yearpub fn (t Time) year() int`Time` 上的方法:年。
t Timeint — 该类型的值
(Time) monthpub fn (t Time) month() int`Time` 上的方法:月。
t Timeint — 该类型的值
(Time) daypub fn (t Time) day() int`Time` 上的方法:日。
t Timeint — 该类型的值
(Time) year_daypub fn (t Time) year_day() int`Time` 上的方法:年日。
t Timeint — 该类型的值
struct Clockpub struct Clock {
pub hour int
pub min int
pub sec int
}公开结构体 `Clock`。
hour intmin intsec int(Time) clockpub fn (t Time) clock() Clock在 `Time` 上调用 `clock`。
t TimeClock — 该类型的值
(Time) nanosecondpub fn (t Time) nanosecond() int在 `Time` 上调用 `nanosecond`。
t Timeint — 该类型的值
struct DatePartspub struct DateParts {
pub year int
pub month int
pub day int
}公开结构体 `DateParts`。
year intmonth intday int(Time) date_partspub fn (t Time) date_parts() DateParts`Time` 上的方法:日期parts。
t TimeDateParts — 该类型的值
(Time) hourpub fn (t Time) hour() int`Time` 上的方法:时。
t Timeint — 该类型的值
(Time) minutepub fn (t Time) minute() int`Time` 上的方法:分。
t Timeint — 该类型的值
(Time) secondpub fn (t Time) second() int`Time` 上的方法:秒。
t Timeint — 该类型的值
struct ISOWeekpub struct ISOWeek {
pub year int
pub week int
}公开结构体 `ISOWeek`。
year intweek int(Time) iso_weekpub fn (t Time) iso_week() ISOWeek`Time` 上的方法:isoweek。
t TimeISOWeek — 该类型的值
(Time) weekdaypub fn (t Time) weekday() int`Time` 上的方法:星期。
t Timeint — 该类型的值
weekday_namepub fn weekday_name(d int) string星期名称。
d intstring — 结果字符串
month_namepub fn month_name(m int) string月名称。
m intstring — 结果字符串
(Time) truncatepub fn (t Time) truncate(d int) Time`Time` 上的方法:截断。
t Timed intTime — 该类型的值
(Time) roundpub fn (t Time) round(d int) Time`Time` 上的方法:舍入。
t Timed intTime — 该类型的值
untilpub fn until(t Time) int直到。
t Timeint — 该类型的值
struct Timerpub struct Timer {
pub c chan int
pub stop chan int
}公开结构体 `Timer`。
c chan intstop chan intnew_timerpub fn new_timer(d int) Timer构造 timer。
d intTimer — 该类型的值
(Timer) stoppub fn (t Timer) stop()`Timer` 上的方法:停止。
t Timerstruct Tickerpub struct Ticker {
pub c chan int
pub stop chan int
}公开结构体 `Ticker`。
c chan intstop chan intnew_tickerpub fn new_ticker(d int) Ticker构造 ticker。
d intTicker — 该类型的值
(Ticker) stoppub fn (t Ticker) stop()`Ticker` 上的方法:停止。
t Tickerstruct Locationpub struct Location {
pub name string
pub offset_sec int
pub dst_offset_sec int
pub has_dst int
pub dst_sm int
pub dst_sn int
pub dst_sd int
pub dst_st int
pub dst_em int
pub dst_en int
pub dst_ed int
pub dst_et int
pub before_off int
pub trans_sec []int
pub trans_off []int
}公开结构体 `Location`。
name stringoffset_sec intdst_offset_sec inthas_dst intdst_sm intdst_sn intdst_sd intdst_st intdst_em intdst_en intdst_ed intdst_et intbefore_off inttrans_sec []inttrans_off []intutcpub fn utc() LocationUTC。
无
Location — 该类型的值
fixed_zonepub fn fixed_zone(name string, offset_sec int) Locationfixedzone。
name stringoffset_sec intLocation — 该类型的值
load_locationpub fn load_location(name string) Location读location。失败时 throw。
name stringLocation — 该类型的值
(Time) year_inpub fn (t Time) year_in(loc &Location) int`Time` 上的方法:年in。
t Timeloc &Locationint — 该类型的值
(Time) month_inpub fn (t Time) month_in(loc &Location) int`Time` 上的方法:月in。
t Timeloc &Locationint — 该类型的值
(Time) day_inpub fn (t Time) day_in(loc &Location) int`Time` 上的方法:日in。
t Timeloc &Locationint — 该类型的值
(Time) hour_inpub fn (t Time) hour_in(loc &Location) int`Time` 上的方法:时in。
t Timeloc &Locationint — 该类型的值
(Time) minute_inpub fn (t Time) minute_in(loc &Location) int`Time` 上的方法:分in。
t Timeloc &Locationint — 该类型的值
(Time) second_inpub fn (t Time) second_in(loc &Location) int`Time` 上的方法:秒in。
t Timeloc &Locationint — 该类型的值
(Time) format_rfc3339_inpub fn (t Time) format_rfc3339_in(loc &Location) string`Time` 上的方法:格式化为 rfc3339 in。
t Timeloc &Locationstring — 结果字符串