mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
time: gmt offset; macos syscalls
This commit is contained in:
@@ -79,6 +79,7 @@ struct C.tm {
|
||||
tm_hour int
|
||||
tm_min int
|
||||
tm_sec int
|
||||
tm_gmtoff int // seconds
|
||||
}
|
||||
|
||||
fn C.time(int) C.time_t
|
||||
@@ -106,7 +107,7 @@ pub fn convert_ctime(t tm) Time {
|
||||
minute: t.tm_min
|
||||
second: t.tm_sec
|
||||
unix: C.mktime(&t)
|
||||
}
|
||||
}.add_seconds(t.tm_gmtoff)
|
||||
}
|
||||
|
||||
// format_ss returns a string for t in a given format YYYY-MM-DD HH:MM:SS in
|
||||
|
||||
@@ -22,14 +22,12 @@ fn test_is_leap_year() {
|
||||
}
|
||||
|
||||
fn test_now_format() {
|
||||
/*
|
||||
t := time.now()
|
||||
u:=t.uni
|
||||
u:=t.unix
|
||||
println(u)
|
||||
println(t.format())
|
||||
println(time.unix(u).format())
|
||||
assert t.format() == time.unix(u).format()
|
||||
*/
|
||||
}
|
||||
|
||||
fn check_days_in_month(month, year, expected int) bool {
|
||||
@@ -99,18 +97,6 @@ fn test_unix() {
|
||||
assert t6.second == 29
|
||||
}
|
||||
|
||||
fn test_unix2() {
|
||||
/*
|
||||
println(t.year)
|
||||
assert t.year == 2019
|
||||
assert t.month == 12
|
||||
assert t.day == 31
|
||||
assert t.hour == 8
|
||||
assert t.minute == 9
|
||||
assert t.second == 53
|
||||
*/
|
||||
}
|
||||
|
||||
fn test_format_ss() {
|
||||
assert '11.07.1980 21:23:42' == time_to_test.get_fmt_str(.dot, .hhmmss24, .ddmmyyyy)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user