time/core
sourcetime/core.sx
extern (C) fn localtime(timep: ref i64) ref void = trust { ... } = "localtime"
extern (C) fn gettimeofday(tv: ref TimeVal, tz: ref void) i32 = trust { ... } = "gettimeofday"
extern (C) fn usleep(usec: u32) i32 = trust { ... } = "usleep"
extern (C) fn Sleep(ms: u32) void = trust { ... } = "Sleep"
extern type TimeVal = { tv_sec: i64, tv_usec: i64 }
Fields
| Name | Type |
|---|
tv_sec | i64 |
tv_usec | i64 |
type DateTime = { year: mut i64, month: mut i64, day: mut i64, hour: mut i64, minute: mut i64, second: mut i64, millis: mut i64 }
A DateTime holds a calendar date and wall-clock time.
Fields
| Name | Type |
|---|
year | mut i64 |
month | mut i64 |
day | mut i64 |
hour | mut i64 |
minute | mut i64 |
second | mut i64 |
millis | mut i64 |
pub fn (DateTime) new[A: allocators.Allocator](ac: A, year: i64, month: i64, day: i64, hour: i64, minute: i64, second: i64, millis: i64) DateTime
pub fn (DateTime) now[A: allocators.Allocator](ac: A) DateTime
pub fn unix_now[A: allocators.Allocator](ac: A) i64
pub fn unix_now_millis[A: allocators.Allocator](ac: A) i64
pub fn unix_now_micros[A: allocators.Allocator](ac: A) i64
pub fn sleep_millis(ms: i64) void = trust { ... }
pub fn (DateTime) year(dt: DateTime) i64
pub fn (DateTime) month(dt: DateTime) i64
pub fn (DateTime) day(dt: DateTime) i64
pub fn (DateTime) hour(dt: DateTime) i64
pub fn (DateTime) minute(dt: DateTime) i64
pub fn (DateTime) second(dt: DateTime) i64
pub fn (DateTime) millis(dt: DateTime) i64
pub fn (DateTime) to_unix(dt: DateTime) i64
pub fn (DateTime) is_leap_year(dt: DateTime) bool
pub fn (DateTime) days_in_month(dt: DateTime) i64
pub fn (DateTime) equals(a: DateTime, b: DateTime) bool
pub fn (DateTime) before(a: DateTime, b: DateTime) bool
pub fn (DateTime) after(a: DateTime, b: DateTime) bool
pub fn (DateTime) diff_seconds(a: DateTime, b: DateTime) i64