-- Module : System.Time
-- Copyright : (c) The University of Glasgow 2001
-- License : BSD-style (see the file libraries/core/LICENSE)
-- Module : System.Time
-- Copyright : (c) The University of Glasgow 2001
-- License : BSD-style (see the file libraries/core/LICENSE)
-- The standard Time library.
--
-----------------------------------------------------------------------------
-- The standard Time library.
--
-----------------------------------------------------------------------------
-- -----------------------------------------------------------------------------
-- getClockTime returns the current time in its internal representation.
-- -----------------------------------------------------------------------------
-- getClockTime returns the current time in its internal representation.
-foreign import "ghcTimezone" unsafe timezone :: Ptr CLong
-foreign import "ghcTzname" unsafe tzname :: Ptr (Ptr CChar)
+foreign import ccall unsafe "__hscore_timezone" timezone :: Ptr CLong
+foreign import ccall unsafe "__hscore_tzname" tzname :: Ptr (Ptr CChar)
# endif /* ! HAVE_TZNAME */
-- Get the offset in secs from UTC, if (struct tm) doesn't supply it. */
# endif /* ! HAVE_TZNAME */
-- Get the offset in secs from UTC, if (struct tm) doesn't supply it. */
gmtoff x = do
dst <- (#peek struct tm,tm_isdst) x
tz <- if dst then peek altzone else peek timezone
return (fromIntegral tz)
# define GMTOFF(x) (((struct tm *)x)->tm_isdst ? altzone : timezone )
# else /* ! HAVE_ALTZONE */
gmtoff x = do
dst <- (#peek struct tm,tm_isdst) x
tz <- if dst then peek altzone else peek timezone
return (fromIntegral tz)
# define GMTOFF(x) (((struct tm *)x)->tm_isdst ? altzone : timezone )
# else /* ! HAVE_ALTZONE */
-- Assume that DST offset is 1 hour ...
gmtoff x = do
dst <- (#peek struct tm,tm_isdst) x
-- Assume that DST offset is 1 hour ...
gmtoff x = do
dst <- (#peek struct tm,tm_isdst) x
-foreign import unsafe mktime :: Ptr CTm -> IO CTime
-foreign import unsafe time :: Ptr CTime -> IO CTime
+foreign import ccall unsafe mktime :: Ptr CTm -> IO CTime
+foreign import ccall unsafe time :: Ptr CTime -> IO CTime