mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
all: C++ compiler support
This commit is contained in:
@@ -12,7 +12,7 @@ pub mut:
|
||||
}
|
||||
|
||||
pub fn new_stopwatch() StopWatch {
|
||||
return StopWatch{start: time.sys_mono_now()}
|
||||
return StopWatch{pause_time: 0, start: time.sys_mono_now(), end: 0}
|
||||
}
|
||||
|
||||
// start Starts the timer. If the timer was paused, restarts counting.
|
||||
|
@@ -76,23 +76,18 @@ pub enum FormatDelimiter {
|
||||
no_delimiter
|
||||
}
|
||||
|
||||
// TODO: C.time_t. works in v2
|
||||
type time_t voidptr
|
||||
|
||||
pub struct C.timeval {
|
||||
tv_sec u64
|
||||
tv_usec u64
|
||||
}
|
||||
|
||||
fn C.localtime(int) &C.tm
|
||||
|
||||
fn C.time(int) time_t
|
||||
fn C.localtime(t &C.time_t) &C.tm
|
||||
fn C.time(t &C.time_t) C.time_t
|
||||
|
||||
// now returns current local time.
|
||||
pub fn now() Time {
|
||||
t := C.time(0)
|
||||
mut now := &C.tm(0)
|
||||
now = C.localtime(&t)
|
||||
now := C.localtime(&t)
|
||||
return convert_ctime(now)
|
||||
}
|
||||
|
||||
|
@@ -4,12 +4,12 @@
|
||||
module time
|
||||
|
||||
struct C.tm {
|
||||
tm_year int
|
||||
tm_mon int
|
||||
tm_mday int
|
||||
tm_hour int
|
||||
tm_min int
|
||||
tm_sec int
|
||||
tm_min int
|
||||
tm_hour int
|
||||
tm_mday int
|
||||
tm_mon int
|
||||
tm_year int
|
||||
}
|
||||
|
||||
fn C.timegm(&tm) time_t
|
||||
|
Reference in New Issue
Block a user