[project @ 2002-07-16 16:08:58 by ross]
[ghc-base.git] / System / Time.hsc
index b281f6d..6d8a800 100644 (file)
@@ -1,5 +1,5 @@
 -----------------------------------------------------------------------------
--- 
+-- |
 -- Module      :  System.Time
 -- Copyright   :  (c) The University of Glasgow 2001
 -- License     :  BSD-style (see the file libraries/core/LICENSE)
@@ -8,8 +8,6 @@
 -- Stability   :  provisional
 -- Portability :  portable
 --
--- $Id: Time.hsc,v 1.10 2002/03/19 10:59:01 simonmar Exp $
---
 -- The standard Time library.
 --
 -----------------------------------------------------------------------------
@@ -201,6 +199,7 @@ noTimeDiff = TimeDiff 0 0 0 0 0 0 0
 -- -----------------------------------------------------------------------------
 -- getClockTime returns the current time in its internal representation.
 
+getClockTime :: IO ClockTime
 #if HAVE_GETTIMEOFDAY
 getClockTime = do
   allocaBytes (#const sizeof(struct timeval)) $ \ p_timeval -> do
@@ -317,7 +316,7 @@ gmtoff x    = (#peek struct tm,tm_gmtoff) x
 #   define tzname _tzname
 #  endif
 #  ifndef mingw32_TARGET_OS
-foreign import ccall "&tzname" :: Ptr (Ptr CChar)
+foreign import ccall unsafe "&tzname" tzname :: Ptr (Ptr CChar)
 #  else
 foreign import ccall unsafe "__hscore_timezone" timezone :: Ptr CLong
 foreign import ccall unsafe "__hscore_tzname"   tzname :: Ptr (Ptr CChar)
@@ -331,19 +330,20 @@ zone x = do
 # endif /* ! HAVE_TZNAME */
 
 -- Get the offset in secs from UTC, if (struct tm) doesn't supply it. */
-#if defined(mingw32_TARGET_OS) || defined(cygwin32_TARGET_OS)
-#define timezone _timezone
-#endif
-
 # if HAVE_ALTZONE
-foreign import ccall "&altzone"  :: Ptr CTime
-foreign import ccall "&timezone" :: Ptr CTime
+foreign import ccall "&altzone"  altzone  :: Ptr CTime
+foreign import ccall "&timezone" timezone :: Ptr CTime
 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 */
+
+#if !defined(mingw32_TARGET_OS)
+foreign import ccall unsafe "timezone" timezone :: Ptr CLong
+#endif
+
 -- Assume that DST offset is 1 hour ...
 gmtoff x = do 
   dst <- (#peek struct tm,tm_isdst) x