Add time vocab that can set system clock time
parent
d050ad5906
commit
c59b71d6ae
|
@ -0,0 +1 @@
|
|||
Doug Coleman
|
|
@ -0,0 +1 @@
|
|||
Doug Coleman
|
|
@ -0,0 +1,15 @@
|
|||
! Copyright (C) 2010 Doug Coleman.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: alien.data calendar calendar.unix classes.struct
|
||||
io.files.info.unix.private kernel system time unix unix.time ;
|
||||
IN: time.macosx
|
||||
|
||||
M: macosx adjust-time-monotonic
|
||||
timestamp>timeval
|
||||
\ timeval <struct>
|
||||
[ adjtime io-error ] keep dup binary-zero? [
|
||||
drop instant
|
||||
] [
|
||||
timeval>duration since-1970 now time-
|
||||
] if ;
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
! Copyright (C) 2010 Doug Coleman.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: system ;
|
||||
IN: time
|
||||
|
||||
HOOK: set-time os ( timestamp -- )
|
||||
HOOK: adjust-time-monotonic os ( timestamp -- seconds )
|
|
@ -0,0 +1 @@
|
|||
Doug Coleman
|
|
@ -0,0 +1,9 @@
|
|||
! Copyright (C) 2010 Doug Coleman.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: calendar kernel math system time unix unix.time ;
|
||||
IN: time.unix
|
||||
|
||||
M: unix set-time
|
||||
[ unix-1970 time- duration>microseconds >integer make-timeval ]
|
||||
[ timestamp>timezone ] bi
|
||||
settimeofday io-error ;
|
Loading…
Reference in New Issue