module Bindings.GLib.Utilities.DateAndTimeFunctions where
import Foreign.Ptr (Ptr,FunPtr,plusPtr)
import Foreign.Ptr (wordPtrToPtr,castPtrToFunPtr)
import Foreign.Storable
import Foreign.C.Types
import Foreign.C.String (CString,CStringLen,CWString,CWStringLen)
import Foreign.Marshal.Alloc (alloca)
import Foreign.Marshal.Array (peekArray,pokeArray)
import Data.Int
import Data.Word
import Bindings.GLib.Fundamentals
c'G_USEC_PER_SEC = 1000000
c'G_USEC_PER_SEC :: (Num a) => a
data C'GTimeVal = C'GTimeVal{
c'GTimeVal'tv_sec :: C'glong
,
c'GTimeVal'tv_usec :: C'glong
} deriving (Eq,Show)
instance Storable C'GTimeVal where
sizeOf _ = 8
alignment = sizeOf
peek p = do
v0 <- peekByteOff p 0
v1 <- peekByteOff p 4
return $ C'GTimeVal v0 v1
poke p (C'GTimeVal v0 v1) = do
pokeByteOff p 0 v0
pokeByteOff p 4 v1
return ()
foreign import ccall "g_get_current_time" c'g_get_current_time
:: Ptr C'GTimeVal -> IO ()
foreign import ccall "&g_get_current_time" p'g_get_current_time
:: FunPtr (Ptr C'GTimeVal -> IO ())
foreign import ccall "g_usleep" c'g_usleep
:: C'gulong -> IO ()
foreign import ccall "&g_usleep" p'g_usleep
:: FunPtr (C'gulong -> IO ())
foreign import ccall "g_time_val_add" c'g_time_val_add
:: Ptr C'GTimeVal -> C'glong -> IO ()
foreign import ccall "&g_time_val_add" p'g_time_val_add
:: FunPtr (Ptr C'GTimeVal -> C'glong -> IO ())
foreign import ccall "g_time_val_from_iso8601" c'g_time_val_from_iso8601
:: Ptr C'gchar -> Ptr C'GTimeVal -> IO C'gboolean
foreign import ccall "&g_time_val_from_iso8601" p'g_time_val_from_iso8601
:: FunPtr (Ptr C'gchar -> Ptr C'GTimeVal -> IO C'gboolean)
foreign import ccall "g_time_val_to_iso8601" c'g_time_val_to_iso8601
:: Ptr C'GTimeVal -> IO (Ptr C'gchar)
foreign import ccall "&g_time_val_to_iso8601" p'g_time_val_to_iso8601
:: FunPtr (Ptr C'GTimeVal -> IO (Ptr C'gchar))
data C'GDate = C'GDate{
} deriving (Eq,Show)
instance Storable C'GDate where
sizeOf _ = 8
alignment = sizeOf
peek p = do
return $ C'GDate
poke p (C'GDate) = do
return ()
type C'GDateDMY = CUInt
c'G_DATE_DAY = 0
c'G_DATE_DAY :: (Num a) => a
c'G_DATE_MONTH = 1
c'G_DATE_MONTH :: (Num a) => a
c'G_DATE_YEAR = 2
c'G_DATE_YEAR :: (Num a) => a
type C'GDateDay = CUChar
type C'GDateMonth = CUInt
c'G_DATE_BAD_MONTH = 0
c'G_DATE_BAD_MONTH :: (Num a) => a
c'G_DATE_JANUARY = 1
c'G_DATE_JANUARY :: (Num a) => a
c'G_DATE_FEBRUARY = 2
c'G_DATE_FEBRUARY :: (Num a) => a
c'G_DATE_MARCH = 3
c'G_DATE_MARCH :: (Num a) => a
c'G_DATE_APRIL = 4
c'G_DATE_APRIL :: (Num a) => a
c'G_DATE_MAY = 5
c'G_DATE_MAY :: (Num a) => a
c'G_DATE_JUNE = 6
c'G_DATE_JUNE :: (Num a) => a
c'G_DATE_JULY = 7
c'G_DATE_JULY :: (Num a) => a
c'G_DATE_AUGUST = 8
c'G_DATE_AUGUST :: (Num a) => a
c'G_DATE_SEPTEMBER = 9
c'G_DATE_SEPTEMBER :: (Num a) => a
c'G_DATE_OCTOBER = 10
c'G_DATE_OCTOBER :: (Num a) => a
c'G_DATE_NOVEMBER = 11
c'G_DATE_NOVEMBER :: (Num a) => a
c'G_DATE_DECEMBER = 12
c'G_DATE_DECEMBER :: (Num a) => a
type C'GDateYear = Word16
type C'GDateWeekday = CUInt
c'G_DATE_BAD_WEEKDAY = 0
c'G_DATE_BAD_WEEKDAY :: (Num a) => a
c'G_DATE_MONDAY = 1
c'G_DATE_MONDAY :: (Num a) => a
c'G_DATE_TUESDAY = 2
c'G_DATE_TUESDAY :: (Num a) => a
c'G_DATE_WEDNESDAY = 3
c'G_DATE_WEDNESDAY :: (Num a) => a
c'G_DATE_THURSDAY = 4
c'G_DATE_THURSDAY :: (Num a) => a
c'G_DATE_FRIDAY = 5
c'G_DATE_FRIDAY :: (Num a) => a
c'G_DATE_SATURDAY = 6
c'G_DATE_SATURDAY :: (Num a) => a
c'G_DATE_SUNDAY = 7
c'G_DATE_SUNDAY :: (Num a) => a
c'G_DATE_BAD_DAY = 0
c'G_DATE_BAD_DAY :: (Num a) => a
c'G_DATE_BAD_JULIAN = 0
c'G_DATE_BAD_JULIAN :: (Num a) => a
c'G_DATE_BAD_YEAR = 0
c'G_DATE_BAD_YEAR :: (Num a) => a
foreign import ccall "g_date_new" c'g_date_new
:: IO (Ptr C'GDate)
foreign import ccall "&g_date_new" p'g_date_new
:: FunPtr (IO (Ptr C'GDate))
foreign import ccall "g_date_new_dmy" c'g_date_new_dmy
:: C'GDateDay -> C'GDateMonth -> C'GDateYear -> IO (Ptr C'GDate)
foreign import ccall "&g_date_new_dmy" p'g_date_new_dmy
:: FunPtr (C'GDateDay -> C'GDateMonth -> C'GDateYear -> IO (Ptr C'GDate))
foreign import ccall "g_date_new_julian" c'g_date_new_julian
:: C'guint32 -> IO (Ptr C'GDate)
foreign import ccall "&g_date_new_julian" p'g_date_new_julian
:: FunPtr (C'guint32 -> IO (Ptr C'GDate))
foreign import ccall "g_date_clear" c'g_date_clear
:: Ptr C'GDate -> C'guint -> IO ()
foreign import ccall "&g_date_clear" p'g_date_clear
:: FunPtr (Ptr C'GDate -> C'guint -> IO ())
foreign import ccall "g_date_free" c'g_date_free
:: Ptr C'GDate -> IO ()
foreign import ccall "&g_date_free" p'g_date_free
:: FunPtr (Ptr C'GDate -> IO ())
foreign import ccall "g_date_set_day" c'g_date_set_day
:: Ptr C'GDate -> C'GDateDay -> IO ()
foreign import ccall "&g_date_set_day" p'g_date_set_day
:: FunPtr (Ptr C'GDate -> C'GDateDay -> IO ())
foreign import ccall "g_date_set_month" c'g_date_set_month
:: Ptr C'GDate -> C'GDateMonth -> IO ()
foreign import ccall "&g_date_set_month" p'g_date_set_month
:: FunPtr (Ptr C'GDate -> C'GDateMonth -> IO ())
foreign import ccall "g_date_set_year" c'g_date_set_year
:: Ptr C'GDate -> C'GDateYear -> IO ()
foreign import ccall "&g_date_set_year" p'g_date_set_year
:: FunPtr (Ptr C'GDate -> C'GDateYear -> IO ())
foreign import ccall "g_date_set_dmy" c'g_date_set_dmy
:: Ptr C'GDate -> C'GDateDay -> C'GDateMonth -> C'GDateYear -> IO ()
foreign import ccall "&g_date_set_dmy" p'g_date_set_dmy
:: FunPtr (Ptr C'GDate -> C'GDateDay -> C'GDateMonth -> C'GDateYear -> IO ())
foreign import ccall "g_date_set_julian" c'g_date_set_julian
:: Ptr C'GDate -> C'guint32 -> IO ()
foreign import ccall "&g_date_set_julian" p'g_date_set_julian
:: FunPtr (Ptr C'GDate -> C'guint32 -> IO ())
foreign import ccall "g_date_set_time_t" c'g_date_set_time_t
:: Ptr C'GDate -> CTime -> IO ()
foreign import ccall "&g_date_set_time_t" p'g_date_set_time_t
:: FunPtr (Ptr C'GDate -> CTime -> IO ())
foreign import ccall "g_date_set_time_val" c'g_date_set_time_val
:: Ptr C'GDate -> Ptr C'GTimeVal -> IO ()
foreign import ccall "&g_date_set_time_val" p'g_date_set_time_val
:: FunPtr (Ptr C'GDate -> Ptr C'GTimeVal -> IO ())
foreign import ccall "g_date_set_parse" c'g_date_set_parse
:: Ptr C'GDate -> Ptr C'gchar -> IO ()
foreign import ccall "&g_date_set_parse" p'g_date_set_parse
:: FunPtr (Ptr C'GDate -> Ptr C'gchar -> IO ())
foreign import ccall "g_date_add_days" c'g_date_add_days
:: Ptr C'GDate -> C'guint -> IO ()
foreign import ccall "&g_date_add_days" p'g_date_add_days
:: FunPtr (Ptr C'GDate -> C'guint -> IO ())
foreign import ccall "g_date_subtract_days" c'g_date_subtract_days
:: Ptr C'GDate -> C'guint -> IO ()
foreign import ccall "&g_date_subtract_days" p'g_date_subtract_days
:: FunPtr (Ptr C'GDate -> C'guint -> IO ())
foreign import ccall "g_date_add_months" c'g_date_add_months
:: Ptr C'GDate -> C'guint -> IO ()
foreign import ccall "&g_date_add_months" p'g_date_add_months
:: FunPtr (Ptr C'GDate -> C'guint -> IO ())
foreign import ccall "g_date_subtract_months" c'g_date_subtract_months
:: Ptr C'GDate -> C'guint -> IO ()
foreign import ccall "&g_date_subtract_months" p'g_date_subtract_months
:: FunPtr (Ptr C'GDate -> C'guint -> IO ())
foreign import ccall "g_date_add_years" c'g_date_add_years
:: Ptr C'GDate -> C'guint -> IO ()
foreign import ccall "&g_date_add_years" p'g_date_add_years
:: FunPtr (Ptr C'GDate -> C'guint -> IO ())
foreign import ccall "g_date_subtract_years" c'g_date_subtract_years
:: Ptr C'GDate -> C'guint -> IO ()
foreign import ccall "&g_date_subtract_years" p'g_date_subtract_years
:: FunPtr (Ptr C'GDate -> C'guint -> IO ())
foreign import ccall "g_date_days_between" c'g_date_days_between
:: Ptr C'GDate -> Ptr C'GDate -> IO C'gint
foreign import ccall "&g_date_days_between" p'g_date_days_between
:: FunPtr (Ptr C'GDate -> Ptr C'GDate -> IO C'gint)
foreign import ccall "g_date_compare" c'g_date_compare
:: Ptr C'GDate -> Ptr C'GDate -> IO C'gint
foreign import ccall "&g_date_compare" p'g_date_compare
:: FunPtr (Ptr C'GDate -> Ptr C'GDate -> IO C'gint)
foreign import ccall "g_date_clamp" c'g_date_clamp
:: Ptr C'GDate -> Ptr C'GDate -> Ptr C'GDate -> IO ()
foreign import ccall "&g_date_clamp" p'g_date_clamp
:: FunPtr (Ptr C'GDate -> Ptr C'GDate -> Ptr C'GDate -> IO ())
foreign import ccall "g_date_order" c'g_date_order
:: Ptr C'GDate -> Ptr C'GDate -> IO ()
foreign import ccall "&g_date_order" p'g_date_order
:: FunPtr (Ptr C'GDate -> Ptr C'GDate -> IO ())
foreign import ccall "g_date_get_day" c'g_date_get_day
:: Ptr C'GDate -> IO C'GDateDay
foreign import ccall "&g_date_get_day" p'g_date_get_day
:: FunPtr (Ptr C'GDate -> IO C'GDateDay)
foreign import ccall "g_date_get_month" c'g_date_get_month
:: Ptr C'GDate -> IO C'GDateMonth
foreign import ccall "&g_date_get_month" p'g_date_get_month
:: FunPtr (Ptr C'GDate -> IO C'GDateMonth)
foreign import ccall "g_date_get_year" c'g_date_get_year
:: Ptr C'GDate -> IO C'GDateYear
foreign import ccall "&g_date_get_year" p'g_date_get_year
:: FunPtr (Ptr C'GDate -> IO C'GDateYear)
foreign import ccall "g_date_get_julian" c'g_date_get_julian
:: Ptr C'GDate -> IO C'guint32
foreign import ccall "&g_date_get_julian" p'g_date_get_julian
:: FunPtr (Ptr C'GDate -> IO C'guint32)
foreign import ccall "g_date_get_weekday" c'g_date_get_weekday
:: Ptr C'GDate -> IO C'GDateWeekday
foreign import ccall "&g_date_get_weekday" p'g_date_get_weekday
:: FunPtr (Ptr C'GDate -> IO C'GDateWeekday)
foreign import ccall "g_date_get_day_of_year" c'g_date_get_day_of_year
:: Ptr C'GDate -> IO C'guint
foreign import ccall "&g_date_get_day_of_year" p'g_date_get_day_of_year
:: FunPtr (Ptr C'GDate -> IO C'guint)
foreign import ccall "g_date_get_days_in_month" c'g_date_get_days_in_month
:: C'GDateMonth -> C'GDateYear -> IO C'guint8
foreign import ccall "&g_date_get_days_in_month" p'g_date_get_days_in_month
:: FunPtr (C'GDateMonth -> C'GDateYear -> IO C'guint8)
foreign import ccall "g_date_is_first_of_month" c'g_date_is_first_of_month
:: Ptr C'GDate -> IO C'gboolean
foreign import ccall "&g_date_is_first_of_month" p'g_date_is_first_of_month
:: FunPtr (Ptr C'GDate -> IO C'gboolean)
foreign import ccall "g_date_is_last_of_month" c'g_date_is_last_of_month
:: Ptr C'GDate -> IO C'gboolean
foreign import ccall "&g_date_is_last_of_month" p'g_date_is_last_of_month
:: FunPtr (Ptr C'GDate -> IO C'gboolean)
foreign import ccall "g_date_is_leap_year" c'g_date_is_leap_year
:: C'GDateYear -> IO C'gboolean
foreign import ccall "&g_date_is_leap_year" p'g_date_is_leap_year
:: FunPtr (C'GDateYear -> IO C'gboolean)
foreign import ccall "g_date_get_monday_week_of_year" c'g_date_get_monday_week_of_year
:: Ptr C'GDate -> IO C'guint
foreign import ccall "&g_date_get_monday_week_of_year" p'g_date_get_monday_week_of_year
:: FunPtr (Ptr C'GDate -> IO C'guint)
foreign import ccall "g_date_get_monday_weeks_in_year" c'g_date_get_monday_weeks_in_year
:: C'GDateYear -> IO C'guint8
foreign import ccall "&g_date_get_monday_weeks_in_year" p'g_date_get_monday_weeks_in_year
:: FunPtr (C'GDateYear -> IO C'guint8)
foreign import ccall "g_date_get_sunday_week_of_year" c'g_date_get_sunday_week_of_year
:: Ptr C'GDate -> IO C'guint
foreign import ccall "&g_date_get_sunday_week_of_year" p'g_date_get_sunday_week_of_year
:: FunPtr (Ptr C'GDate -> IO C'guint)
foreign import ccall "g_date_get_sunday_weeks_in_year" c'g_date_get_sunday_weeks_in_year
:: C'GDateYear -> IO C'guint8
foreign import ccall "&g_date_get_sunday_weeks_in_year" p'g_date_get_sunday_weeks_in_year
:: FunPtr (C'GDateYear -> IO C'guint8)
foreign import ccall "g_date_get_iso8601_week_of_year" c'g_date_get_iso8601_week_of_year
:: Ptr C'GDate -> IO C'guint
foreign import ccall "&g_date_get_iso8601_week_of_year" p'g_date_get_iso8601_week_of_year
:: FunPtr (Ptr C'GDate -> IO C'guint)
foreign import ccall "g_date_strftime" c'g_date_strftime
:: Ptr C'gchar -> C'gsize -> Ptr C'gchar -> Ptr C'GDate -> IO C'gsize
foreign import ccall "&g_date_strftime" p'g_date_strftime
:: FunPtr (Ptr C'gchar -> C'gsize -> Ptr C'gchar -> Ptr C'GDate -> IO C'gsize)
data C'tm = C'tm
foreign import ccall "g_date_to_struct_tm" c'g_date_to_struct_tm
:: Ptr C'GDate -> Ptr C'tm -> IO ()
foreign import ccall "&g_date_to_struct_tm" p'g_date_to_struct_tm
:: FunPtr (Ptr C'GDate -> Ptr C'tm -> IO ())
foreign import ccall "g_date_valid" c'g_date_valid
:: Ptr C'GDate -> IO C'gboolean
foreign import ccall "&g_date_valid" p'g_date_valid
:: FunPtr (Ptr C'GDate -> IO C'gboolean)
foreign import ccall "g_date_valid_day" c'g_date_valid_day
:: C'GDateDay -> IO C'gboolean
foreign import ccall "&g_date_valid_day" p'g_date_valid_day
:: FunPtr (C'GDateDay -> IO C'gboolean)
foreign import ccall "g_date_valid_month" c'g_date_valid_month
:: C'GDateMonth -> IO C'gboolean
foreign import ccall "&g_date_valid_month" p'g_date_valid_month
:: FunPtr (C'GDateMonth -> IO C'gboolean)
foreign import ccall "g_date_valid_year" c'g_date_valid_year
:: C'GDateYear -> IO C'gboolean
foreign import ccall "&g_date_valid_year" p'g_date_valid_year
:: FunPtr (C'GDateYear -> IO C'gboolean)
foreign import ccall "g_date_valid_dmy" c'g_date_valid_dmy
:: C'GDateDay -> C'GDateMonth -> C'GDateYear -> IO C'gboolean
foreign import ccall "&g_date_valid_dmy" p'g_date_valid_dmy
:: FunPtr (C'GDateDay -> C'GDateMonth -> C'GDateYear -> IO C'gboolean)
foreign import ccall "g_date_valid_julian" c'g_date_valid_julian
:: C'guint32 -> IO C'gboolean
foreign import ccall "&g_date_valid_julian" p'g_date_valid_julian
:: FunPtr (C'guint32 -> IO C'gboolean)
foreign import ccall "g_date_valid_weekday" c'g_date_valid_weekday
:: C'GDateWeekday -> IO C'gboolean
foreign import ccall "&g_date_valid_weekday" p'g_date_valid_weekday
:: FunPtr (C'GDateWeekday -> IO C'gboolean)