From a18b4ebe53b92bdfd298714eceaec3f165059b8d Mon Sep 17 00:00:00 2001 From: sof Date: Mon, 25 Aug 1997 22:36:24 +0000 Subject: [PATCH] [project @ 1997-08-25 22:36:06 by sof] Changed to use PackBase --- ghc/lib/required/System.lhs | 2 +- ghc/lib/required/Time.lhs | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/ghc/lib/required/System.lhs b/ghc/lib/required/System.lhs index bdf6ad3..75d1fc7 100644 --- a/ghc/lib/required/System.lhs +++ b/ghc/lib/required/System.lhs @@ -14,7 +14,7 @@ import Prelude import Foreign ( Addr ) import IOBase ( IOError(..), IOErrorType(..), thenIO_Prim, constructErrorAndFail ) import ArrBase ( indexAddrOffAddr ) -import PackedString ( unpackCString ) +import PackBase ( unpackCString ) \end{code} diff --git a/ghc/lib/required/Time.lhs b/ghc/lib/required/Time.lhs index d605ad4..26920d0 100644 --- a/ghc/lib/required/Time.lhs +++ b/ghc/lib/required/Time.lhs @@ -32,9 +32,9 @@ import STBase import UnsafeST ( unsafePerformPrimIO ) import ST import Ix -import Foreign( Addr(..) ) -import Char (intToDigit) -import PackedString (unpackPS, packCBytesST) +import Foreign ( Addr(..) ) +import Char ( intToDigit ) +import PackBase ( unpackCString ) import Locale \end{code} @@ -76,9 +76,7 @@ instance Show ClockTime where allocChars 32 >>= \ buf -> _ccall_ showTime (I# s#) (ByteArray bottom d#) buf >>= \ str -> - _ccall_ strlen str >>= \ len -> - packCBytesST len str >>= \ ps -> - return (unpackPS ps) + return (unpackCString str) showList = showList__ (showsPrec 0) \end{code} @@ -247,10 +245,11 @@ toCalendarTime (TOD sec@(J# a# s# d#) psec) = unsafePerformPrimIO $ _casm_ ``%r = ((struct tm *)%0)->tm_isdst;'' tm >>= \ isdst -> _ccall_ ZONE tm >>= \ zone -> _ccall_ GMTOFF tm >>= \ tz -> - _ccall_ strlen zone >>= \ len -> - packCBytesST len zone >>= \ tzname -> + let + tzname = unpackCString zone + in returnPrimIO (CalendarTime (1900+year) mon mday hour min sec psec - (toEnum wday) yday (unpackPS tzname) tz (isdst /= 0)) + (toEnum wday) yday tzname tz (isdst /= 0)) toUTCTime :: ClockTime -> CalendarTime toUTCTime (TOD sec@(J# a# s# d#) psec) = unsafePerformPrimIO ( -- 1.7.10.4