mirror of
https://github.com/vlang/v.git
synced 2025-08-03 09:47:15 -04:00
docs: check vlib/time too in the report-missing-dots-in-doc-comments job
This commit is contained in:
parent
8578fd477a
commit
ae0937c83e
1
.github/workflows/docs_ci.yml
vendored
1
.github/workflows/docs_ci.yml
vendored
@ -69,4 +69,5 @@ jobs:
|
||||
vlib/builtin/ vlib/arrays/ vlib/flag/ \
|
||||
vlib/bitfield/ vlib/term/ vlib/strings/ \
|
||||
vlib/rand/ vlib/compress/ vlib/clipboard/ \
|
||||
vlib/time/ \
|
||||
vlib/os
|
||||
|
@ -1,7 +1,6 @@
|
||||
module time
|
||||
|
||||
// portable_timegm does the same as C._mkgmtime, but unlike it,
|
||||
// can work with dates before the Unix epoch of 1970-01-01 .
|
||||
// portable_timegm does the same as C._mkgmtime, but unlike it, can work with dates before the Unix epoch of 1970-01-01 .
|
||||
pub fn portable_timegm(t &C.tm) i64 {
|
||||
mut year := t.tm_year + 1900
|
||||
mut month := t.tm_mon // 0-11
|
||||
|
@ -91,7 +91,7 @@ pub fn (d Duration) str() string {
|
||||
}
|
||||
}
|
||||
|
||||
// debug returns a detailed breakdown of the Duration, as: 'Duration: - 50days, 4h, 3m, 7s, 541ms, 78us, 9ns'
|
||||
// debug returns a detailed breakdown of the Duration, as: 'Duration: - 50days, 4h, 3m, 7s, 541ms, 78us, 9ns'.
|
||||
pub fn (d Duration) debug() string {
|
||||
mut res := []string{}
|
||||
mut x := i64(d)
|
||||
|
@ -562,7 +562,8 @@ pub fn (t Time) custom_format(s string) string {
|
||||
return sb.str()
|
||||
}
|
||||
|
||||
// clean returns a date string in a following format:
|
||||
// clean returns a date string in a clean form.
|
||||
// It has the following format:
|
||||
// - a date string in "HH:mm" format (24h) for current day
|
||||
// - a date string in "MMM D HH:mm" format (24h) for date of current year
|
||||
// - a date string formatted with format function for other dates
|
||||
@ -579,7 +580,8 @@ pub fn (t Time) clean() string {
|
||||
return t.format()
|
||||
}
|
||||
|
||||
// clean12 returns a date string in a following format:
|
||||
// clean12 returns a date string in a clean form.
|
||||
// It has the following format:
|
||||
// - a date string in "hh:mm" format (12h) for current day
|
||||
// - a date string in "MMM D hh:mm" format (12h) for date of current year
|
||||
// - a date string formatted with format function for other dates
|
||||
@ -653,8 +655,7 @@ pub fn (t Time) get_fmt_date_str(fmt_dlmtr FormatDelimiter, fmt_date FormatDate)
|
||||
return res
|
||||
}
|
||||
|
||||
// get_fmt_str returns a date string with specified FormatDelimiter,
|
||||
// FormatTime type, and FormatDate type.
|
||||
// get_fmt_str returns a date string with specified FormatDelimiter, FormatTime type, and FormatDate type.
|
||||
pub fn (t Time) get_fmt_str(fmt_dlmtr FormatDelimiter, fmt_time FormatTime, fmt_date FormatDate) string {
|
||||
if fmt_date == .no_date {
|
||||
if fmt_time == .no_time {
|
||||
|
@ -61,7 +61,7 @@ pub fn (mut t StopWatch) pause() {
|
||||
t.start = 0
|
||||
}
|
||||
|
||||
// elapsed returns the Duration since the last start call
|
||||
// elapsed returns the Duration since the last start call.
|
||||
pub fn (t StopWatch) elapsed() Duration {
|
||||
if t.start > 0 {
|
||||
if t.end == 0 {
|
||||
|
@ -115,7 +115,7 @@ fn convert_ctime(t C.tm, nanosecond int) Time {
|
||||
}
|
||||
}
|
||||
|
||||
// strftime returns the formatted time using `strftime(3)`
|
||||
// strftime returns the formatted time using `strftime(3)`.
|
||||
pub fn (t Time) strftime(fmt string) string {
|
||||
mut tm := &C.tm{}
|
||||
$if windows {
|
||||
|
@ -279,8 +279,7 @@ pub fn (t Time) relative_short() string {
|
||||
return '${prefix}${y}y${suffix}'
|
||||
}
|
||||
|
||||
// day_of_week returns the current day of a given year, month, and day,
|
||||
// as an integer.
|
||||
// day_of_week returns the current day of a given year, month, and day, as an integer.
|
||||
pub fn day_of_week(y int, m int, d int) int {
|
||||
// Sakomotho's algorithm is explained here:
|
||||
// https://stackoverflow.com/a/6385934
|
||||
@ -365,7 +364,7 @@ pub fn days_in_month(month int, year int) !int {
|
||||
return res
|
||||
}
|
||||
|
||||
// debug returns detailed breakdown of time (`Time{ year: YYYY month: MM day: dd hour: HH: minute: mm second: ss nanosecond: nanos unix: unix }`)
|
||||
// debug returns detailed breakdown of time (`Time{ year: YYYY month: MM day: dd hour: HH: minute: mm second: ss nanosecond: nanos unix: unix }`).
|
||||
pub fn (t Time) debug() string {
|
||||
return 'Time{ year: ${t.year:04} month: ${t.month:02} day: ${t.day:02} hour: ${t.hour:02} minute: ${t.minute:02} second: ${t.second:02} nanosecond: ${t.nanosecond:09} unix: ${t.unix:07} }'
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ fn local_as_unix_time() i64 {
|
||||
return make_unix_time(*tm)
|
||||
}
|
||||
|
||||
// local - return the time `t`, converted to the currently active local timezone
|
||||
// local - return the time `t`, converted to the currently active local timezone.
|
||||
pub fn (t Time) local() Time {
|
||||
if t.is_local {
|
||||
return t
|
||||
|
@ -3,22 +3,22 @@
|
||||
// that can be found in the LICENSE file.
|
||||
module time
|
||||
|
||||
// unix returns a Time calculated from the given Unix timestamp in seconds since 1970-01-01
|
||||
// unix returns a Time calculated from the given Unix timestamp in seconds since 1970-01-01 .
|
||||
pub fn unix(epoch i64) Time {
|
||||
return unix_nanosecond(epoch, 0)
|
||||
}
|
||||
|
||||
// unix_milli returns a Time calculated from the given Unix timestamp in milliseconds since 1970-01-01
|
||||
// unix_milli returns a Time calculated from the given Unix timestamp in milliseconds since 1970-01-01 .
|
||||
pub fn unix_milli(ms i64) Time {
|
||||
return ts_to_time_impl(ms, 1_000, 1_000_000)
|
||||
}
|
||||
|
||||
// unix_micro returns a Time calculated from the given Unix timestamp in microseconds since 1970-01-01
|
||||
// unix_micro returns a Time calculated from the given Unix timestamp in microseconds since 1970-01-01 .
|
||||
pub fn unix_micro(us i64) Time {
|
||||
return ts_to_time_impl(us, 1_000_000, 1_000)
|
||||
}
|
||||
|
||||
// unix_nano returns a Time calculated from the given Unix timestamp in nanoseconds since 1970-01-01
|
||||
// unix_nano returns a Time calculated from the given Unix timestamp in nanoseconds since 1970-01-01 .
|
||||
pub fn unix_nano(ns i64) Time {
|
||||
return ts_to_time_impl(ns, 1_000_000_000, 1)
|
||||
}
|
||||
@ -29,12 +29,12 @@ fn ts_to_time_impl(value i64, down i64, up i64) Time {
|
||||
return unix_nanosecond(epoch, int(remainder))
|
||||
}
|
||||
|
||||
// unix_microsecond returns a Time struct, given an Unix timestamp in seconds, and a microsecond value
|
||||
// unix_microsecond returns a Time struct, given an Unix timestamp in seconds, and a microsecond value.
|
||||
pub fn unix_microsecond(epoch i64, microsecond int) Time {
|
||||
return unix_nanosecond(epoch, microsecond * 1000)
|
||||
}
|
||||
|
||||
// unix_nanosecond returns a Time struct given a Unix timestamp in seconds and a nanosecond value
|
||||
// unix_nanosecond returns a Time struct given a Unix timestamp in seconds and a nanosecond value.
|
||||
pub fn unix_nanosecond(abs_unix_timestamp i64, nanosecond int) Time {
|
||||
// Split into day and time
|
||||
mut day_offset := abs_unix_timestamp / seconds_per_day
|
||||
|
Loading…
x
Reference in New Issue
Block a user