Add more time bindings
parent
e718670997
commit
d050ad5906
|
@ -1,7 +1,7 @@
|
||||||
! Copyright (C) 2008 Doug Coleman.
|
! Copyright (C) 2008 Doug Coleman.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: kernel alien.syntax alien.c-types math unix.types
|
USING: accessors alien.c-types alien.syntax calendar
|
||||||
classes.struct accessors ;
|
classes.struct kernel math unix.types ;
|
||||||
IN: unix.time
|
IN: unix.time
|
||||||
|
|
||||||
STRUCT: timeval
|
STRUCT: timeval
|
||||||
|
@ -24,6 +24,15 @@ STRUCT: timespec
|
||||||
swap >>nsec
|
swap >>nsec
|
||||||
swap >>sec ;
|
swap >>sec ;
|
||||||
|
|
||||||
|
STRUCT: timezone
|
||||||
|
{ tz_minuteswest int }
|
||||||
|
{ tz_dsttime int } ;
|
||||||
|
|
||||||
|
: timestamp>timezone ( timestamp -- timezone )
|
||||||
|
gmt-offset>> duration>minutes
|
||||||
|
1
|
||||||
|
\ timezone <struct-boa> ; inline
|
||||||
|
|
||||||
STRUCT: tm
|
STRUCT: tm
|
||||||
{ sec int }
|
{ sec int }
|
||||||
{ min int }
|
{ min int }
|
||||||
|
@ -40,3 +49,5 @@ STRUCT: tm
|
||||||
FUNCTION: time_t time ( time_t* t ) ;
|
FUNCTION: time_t time ( time_t* t ) ;
|
||||||
FUNCTION: tm* localtime ( time_t* clock ) ;
|
FUNCTION: tm* localtime ( time_t* clock ) ;
|
||||||
FUNCTION: int gettimeofday ( timespec* TP, void* TZP ) ;
|
FUNCTION: int gettimeofday ( timespec* TP, void* TZP ) ;
|
||||||
|
FUNCTION: int settimeofday ( timeval* TP, timezone* TZP ) ;
|
||||||
|
FUNCTION: int adjtime ( timeval* delta, timeval* olddelta ) ;
|
||||||
|
|
Loading…
Reference in New Issue