packages feed

bindings-common-1.0: src/Bindings/C/Time.hsc

#include <bindings.macros.h>
#include <time.h>

-- | <http://www.opengroup.org/onlinepubs/9699919799/basedefs/time.h.html>

module Bindings.C.Time where
import Foreign
import Foreign.C

#integral_t clock_t
#integral_t time_t

#starttype struct tm
#field tm_sec , CInt
#field tm_min , CInt
#field tm_hour , CInt
#field tm_mday , CInt
#field tm_mon , CInt
#field tm_year , CInt
#field tm_wday , CInt
#field tm_yday , CInt
#field tm_isdst , CInt
#stoptype

#num CLOCKS_PER_SEC
#num TIMER_ABSTIME

#ccall clock , IO <clock_t>
#ccall difftime , <time_t> -> <time_t> -> IO CDouble
#ccall gmtime , Ptr <time_t> -> IO (Ptr <tm>)
#ccall localtime , Ptr <time_t> -> IO (Ptr <tm>)
#ccall mktime , Ptr <tm> -> IO <time_t>
#ccall strftime , CString -> CSize -> CString -> Ptr <tm> -> IO CSize
#ccall time , Ptr <time_t> -> IO <time_t>