1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

time: rename to_local_time() to local(); time.offset()

This commit is contained in:
Alexander Medvednikov
2020-12-26 02:10:47 +01:00
parent 7507403118
commit 13f16b4a82
5 changed files with 14 additions and 5 deletions

View File

@ -418,3 +418,10 @@ pub fn (d Duration) hours() f64 {
nsec := d % hour
return f64(hr) + f64(nsec) / (60 * 60 * 1e9)
}
// offset returns time zone UTC offset in seconds
pub fn offset() int {
t := now()
local := t.local()
return int(local.unix - t.unix)
}