From d050ad5906a2e2bc8f8f0357369e1937c0325e0c Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sun, 13 Jun 2010 18:25:08 -0500 Subject: [PATCH] Add more time bindings --- basis/unix/time/time.factor | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/basis/unix/time/time.factor b/basis/unix/time/time.factor index 72132bb132..bd3a02fcab 100644 --- a/basis/unix/time/time.factor +++ b/basis/unix/time/time.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2008 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. -USING: kernel alien.syntax alien.c-types math unix.types -classes.struct accessors ; +USING: accessors alien.c-types alien.syntax calendar +classes.struct kernel math unix.types ; IN: unix.time STRUCT: timeval @@ -24,6 +24,15 @@ STRUCT: timespec swap >>nsec swap >>sec ; +STRUCT: timezone + { tz_minuteswest int } + { tz_dsttime int } ; + +: timestamp>timezone ( timestamp -- timezone ) + gmt-offset>> duration>minutes + 1 + \ timezone ; inline + STRUCT: tm { sec int } { min int } @@ -40,3 +49,5 @@ STRUCT: tm FUNCTION: time_t time ( time_t* t ) ; FUNCTION: tm* localtime ( time_t* clock ) ; FUNCTION: int gettimeofday ( timespec* TP, void* TZP ) ; +FUNCTION: int settimeofday ( timeval* TP, timezone* TZP ) ; +FUNCTION: int adjtime ( timeval* delta, timeval* olddelta ) ;