mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
cgen: treat the main module like any other v module
This commit is contained in:
@@ -48,13 +48,13 @@ pub fn (t Time) md() string {
|
||||
// - 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
|
||||
pub fn (t Time) clean() string {
|
||||
now := time.now()
|
||||
znow := time.now()
|
||||
// Today
|
||||
if t.month == now.month && t.year == now.year && t.day == now.day {
|
||||
if t.month == znow.month && t.year == znow.year && t.day == znow.day {
|
||||
return t.get_fmt_time_str(.hhmm24)
|
||||
}
|
||||
// This year
|
||||
if t.year == now.year {
|
||||
if t.year == znow.year {
|
||||
return t.get_fmt_str(.space, .hhmm24, .mmmd)
|
||||
}
|
||||
return t.format()
|
||||
@@ -65,13 +65,13 @@ pub fn (t Time) clean() string {
|
||||
// - 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
|
||||
pub fn (t Time) clean12() string {
|
||||
now := time.now()
|
||||
znow := time.now()
|
||||
// Today
|
||||
if t.month == now.month && t.year == now.year && t.day == now.day {
|
||||
if t.month == znow.month && t.year == znow.year && t.day == znow.day {
|
||||
return t.get_fmt_time_str(.hhmm12)
|
||||
}
|
||||
// This year
|
||||
if t.year == now.year {
|
||||
if t.year == znow.year {
|
||||
return t.get_fmt_str(.space, .hhmm12, .mmmd)
|
||||
}
|
||||
return t.format()
|
||||
|
@@ -189,8 +189,8 @@ fn since(t Time) int {
|
||||
// relative returns a string representation of difference between time
|
||||
// and current time.
|
||||
pub fn (t Time) relative() string {
|
||||
now := time.now()
|
||||
secs := now.unix - t.unix
|
||||
znow := time.now()
|
||||
secs := znow.unix - t.unix
|
||||
if secs <= 30 {
|
||||
// right now or in the future
|
||||
// TODO handle time in the future
|
||||
@@ -227,8 +227,8 @@ pub fn (t Time) relative() string {
|
||||
}
|
||||
|
||||
pub fn (t Time) relative_short() string {
|
||||
now := time.now()
|
||||
secs := now.unix - t.unix
|
||||
znow := time.now()
|
||||
secs := znow.unix - t.unix
|
||||
if secs <= 30 {
|
||||
// right now or in the future
|
||||
// TODO handle time in the future
|
||||
|
Reference in New Issue
Block a user