summaryrefslogtreecommitdiff
path: root/ghc/lib/std/Time.lhs
Commit message (Collapse)AuthorAgeFilesLines
* [project @ 2001-01-12 16:16:36 by simonmar]simonmar2001-01-121-747/+0
| | | | Time library FFI'd.
* [project @ 2001-01-11 17:25:56 by simonmar]simonmar2001-01-111-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Re-organisation of ghc/lib/std and hslibs/lang ---------------------------------------------- In brief: move deprecated features out of ghc/lib/std and into hslibs/lang, move new FFI libraries into ghc/lib/std and start using them. - foreign import may now return an unboxed type (this was advertised to work before, but in fact didn't). Subsequent cleanups in PrelInt/PrelWord. - Ptr is now defined in ghc/lib/std/PrelPtr.lhs. Ptr is no longer a newtype of Addr, it is defined directly in terms of Addr#. - PrelAddr has disappeared from ghc/lib/std, all uses of Addr in ghc/lib/std have been replaced with Ptr. The definitions of Addr has been moved to hslibs/lang/Addr.lhs, as has lots of other Addr-related stuff. - ForeignObj has been removed from ghc/lib/std, and replaced with ForeignPtr. The definition of ForeignObj has been moved to hslibs/lang/ForeignObj.lhs. - Most of the new FFI has been moved into ghc/lib/std in the form of modules PrelMarshalAlloc, PrelCString, PrelCError, PrelMarshalError, PrelMarshalArray, PrelMarshalUtils, PrelCTypes, PrelCTypesISO, and PrelStorable. The corresponding modules in hslibs/lang simply re-export the contents of these modules. - PrelPosixTypes defines a few POSIX types (CMode == mode_t, etc.) - PrelCError changed to access errno using foreign label and peek (the POSIX book I have says that errno is guaranteed to be an extern int, so this should be OK until I get around to making errno thread-safe). - Hacked the macros that generate the code for CTypes and CTypesISO to generate much less code (ghc/lib/std/cbits/CTypes.h). - RtsAPI is now a bit more honest when it comes to building heap objects (it uses the correct constructors). - the Bits class and related stuff has been moved to ghc/lib/std (it was simpler this way). - Directory and System have been converted to use the new FFI.
* [project @ 2000-12-12 12:19:57 by simonmar]simonmar2000-12-121-5/+5
| | | | | | | | | | | | | - Add primops for {read,write,index}{Int,Word}{8,16,32,64}OffAddr. This enables us to remove all the _casm_s from Int/Word. - Replace new{Char,Int,etc.}Array# with newByteArray# (save a few primops, at the cost of having to know the size of these types in PrelArr). - Implement MArray/IArray support for sized types. finally. - Move the guts of the sized types into ghc/lib/std, we'll need them for doing more FFIish things in the Prelude.
* [project @ 2000-08-29 16:38:04 by simonpj]simonpj2000-08-291-4/+3
| | | | Move prim_ZONE and prim_GMTOFF into Hugs-only code
* [project @ 2000-06-30 13:39:35 by simonmar]simonmar2000-06-301-2/+5
| | | | | | - fix copyrights - remove some unused imports - comment formatting fixes
* [project @ 2000-06-19 13:28:35 by simonmar]simonmar2000-06-191-17/+128
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Time fixes from Michael Weber <michael.weber@post.rwth-aachen.de>: * `toClockTime' previously didn't honor the `tz' field of a `CalendarTime', which led to time warping when applying => (toUTCTime (toClockTime ... (toUTCTime (toClockTime someTime) ... ))) continuously. Now it accepts at least <local>- and UTC-encoded `CalendarTime's (TODO: test, whether all timezones work) and converts them correctly to <secs from epoch>-format (which is always UTC, as one might have guessed). * `addToClockTime' now works. Previously, `tz' seconds were added(!) when used like: => addToClockTime noTimeDiff someTime which is clearly wrong. Now, the following (hopefully) always holds => someTime == (addToClockTime noTimeDiff someTime) * `diffClockTimes' works correctly, and is the dual to `addToClockTime', i.e. => diff == ((addToClockTime diff someTime) `diffClockTimes` someTime) should now hold for all diff, someTime Previously, it reports ugly diffs at {min,hour,day,...}-breaks, for example: => "2000/06/18 01:00 UTC" `diffClockTimes` "2000/06/17 23:00 UTC" == 1 day, -22 hours whereas now it emits "7200 secs". This number can be converted with `normalizeTimeDiff' to "2 hours". * added `normalizeTimeDiff', which calculates year, month, days, etc. out of an unnormalized `TimeDiff' (generated by `diffClockTimes', for example) * `formatTimeDiff': added the missing "%c" case. The format is proprietary, though... Is there a nicer one?
* [project @ 2000-05-01 14:53:47 by panne]panne2000-05-011-4/+4
| | | | | Adding a bunch of `unsafe's to foreign imports. TODO: Could somebody verify that declaring shutdownHaskellAndExit as unsafe is OK?
* [project @ 1999-12-20 10:34:27 by simonpj]simonpj1999-12-201-10/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit implements a substantial re-organisation of the Prelude It also fixes a couple of small renamer bugs that were reported recently (notably, Sven pointed out that we weren't reporting unused imports properly) My original goal was to get rid of all "orphan" modules (i.e. ones with instance decls that don't belong either to a tycon or a class defined in the same module). This should reduce the number of interface files that have to be read when compiling small Haskell modules. But like most expeditions into the Prelude Swamp, it spiraled out of control. The result is quite satisfactory, though. GONE AWAY: PrelCCall, PrelNumExtra NEW: PrelReal, PrelFloat, PrelByteArr, PrelNum.hi-boot (The extra PrelNum.hi-boot is because of a tiresome thin-air Id, addr2Integer, which used to be in PrelBase.) Quite a lot of types have moved from one module to another, which entails some changes to part of the compiler (PrelInfo, PrelMods) etc, and there are a few places in the RTS includes and even in the driver that know about these home modules (alas). So the rough structure is as follows, in (linearised) dependency order [this list now appears in PrelBase.lhs] PrelGHC Has no implementation. It defines built-in things, and by importing it you bring them into scope. The source file is PrelGHC.hi-boot, which is just copied to make PrelGHC.hi Classes: CCallable, CReturnable PrelBase Classes: Eq, Ord, Functor, Monad Types: list, (), Int, Bool, Ordering, Char, String PrelTup Types: tuples, plus instances for PrelBase classes PrelShow Class: Show, plus instances for PrelBase/PrelTup types PrelEnum Class: Enum, plus instances for PrelBase/PrelTup types PrelMaybe Type: Maybe, plus instances for PrelBase classes PrelNum Class: Num, plus instances for Int Type: Integer, plus instances for all classes so far (Eq, Ord, Num, Show) Integer is needed here because it is mentioned in the signature of 'fromInteger' in class Num PrelReal Classes: Real, Integral, Fractional, RealFrac plus instances for Int, Integer Types: Ratio, Rational plus intances for classes so far Rational is needed here because it is mentioned in the signature of 'toRational' in class Real Ix Classes: Ix, plus instances for Int, Bool, Char, Integer, Ordering, tuples PrelArr Types: Array, MutableArray, MutableVar Does *not* contain any ByteArray stuff (see PrelByteArr) Arrays are used by a function in PrelFloat PrelFloat Classes: Floating, RealFloat Types: Float, Double, plus instances of all classes so far This module contains everything to do with floating point. It is a big module (900 lines) With a bit of luck, many modules can be compiled without ever reading PrelFloat.hi PrelByteArr Types: ByteArray, MutableByteArray We want this one to be after PrelFloat, because it defines arrays of unboxed floats. Other Prelude modules are much easier with fewer complex dependencies.
* [project @ 1999-12-08 15:47:06 by simonmar]simonmar1999-12-081-1/+1
| | | | misc ansification and -Wall cleanup
* [project @ 1999-11-25 10:37:12 by simonpj]simonpj1999-11-251-1/+4
| | | | Add a comment
* [project @ 1999-10-18 11:49:47 by sof]sof1999-10-181-35/+55
| | | | | | | | | | | | | | | * Time.CalendarTime.ctMonth's type should be Month (was Int.) * fixed Time.addToClockTime - the original implementation was completely wrong (thanks to George Russell for indirectly reporting the bug.) * Added the non-std Time.noTimeDiff, handy when you want to do calendar calculations, e.g., ct <- getClockTime print (toUTCTime (addToClockTime noTimeDiff{tdMonth=1} ct)) * many 'foreign import' decls were not marked as unsafe, even though they were passing out MutableByteArray and ByteArray vals. Fixed.
* [project @ 1999-10-05 09:02:30 by simonmar]simonmar1999-10-051-6/+5
| | | | | | Flatten out the tuple of bounds in the Array, MutableArray and ByteArray datatypes. This improves performance of heavy array manipulations quite significantly.
* [project @ 1999-09-30 14:25:46 by sof]sof1999-09-301-47/+29
| | | | Common up Hugs&ghc implementation of addToClockTime, clearing up some potential signed vs. unsigned problems in the process
* [project @ 1999-09-30 12:42:25 by sof]sof1999-09-301-6/+17
| | | | primGetClockTime was incorrectly calling prim_getClockTime; fixed dormant bug in Show instance for ClockTime
* [project @ 1999-09-19 19:12:39 by sof]sof1999-09-191-89/+94
| | | | | Drop the use of _ccall_, _casm_ and lit-lits in std/, "foreign import" is the future.
* [project @ 1999-09-12 14:39:50 by sof]sof1999-09-121-1/+1
| | | | s/ZONE/get_ZONE/g
* [project @ 1999-05-18 14:59:04 by simonpj]simonpj1999-05-181-0/+1
| | | | ../compiler/msg_prel
* [project @ 1999-03-01 08:59:45 by sof]sof1999-03-011-19/+19
| | | | foreign imports: stdcall --> ccall
* [project @ 1999-02-17 15:57:20 by simonm]simonm1999-02-171-5/+11
| | | | | | | | | | | | | | | | | | Fast Integers. The rep. of Integers is now data Integer = S# Int# | J# Int# ByteArray# - several new primops added for overflow-detecting arithmetic - negateInteger# removed; it can be done directly - integer_0, integer_1 etc. removed. - the compiler now uses S# where it previously used int2Integer. - the compiler generates small integers for -2^32 .. 2^32-1, instead of -2^29 .. -2^29-1. - PrelST.State datatype moved to LazyST (its only use). - some library code (in Time.lhs) still needs cleaning up, it depends on the Integer rep.
* [project @ 1999-01-14 18:12:47 by sof]sof1999-01-141-66/+71
| | | | | | | Changes to make the Prelude comply with Haskell 98. I claim that this completes GHC's implementation of Haskell 98 (at least feature-wise, but there's bound to be some bugs lurking..)
* [project @ 1998-12-02 13:17:09 by simonm]simonm1998-12-021-18/+179
| | | | Move 4.01 onto the main trunk.
* [project @ 1998-08-14 12:44:39 by sof]sof1998-08-141-6/+6
| | | | toCalendarTime bugfix
* [project @ 1998-08-07 15:11:28 by sof]sof1998-08-071-8/+8
| | | | | | - toCalendarTime should be an action, not a function. - diffClockTimes buglet fixed, now uses toUTCTime instead of toCalendarTime to compute clock diff.
* [project @ 1998-05-22 15:57:05 by simonm]simonm1998-05-221-1/+0
| | | | | | - Add NOINLINE pragmas to the unsafe things (unsafe*IO, unsafe*ST, runST etc.) - Move unsafe function back into the proper modules - Remove PrelUnsafe*.lhs
* [project @ 1998-03-30 08:38:56 by sof]sof1998-03-301-76/+119
| | | | | - added (non standard) functions: timeDiffToString and formatTimeDiff - fully export Month and Day (non standard, but useful, too.)
* [project @ 1998-02-02 17:27:26 by simonm]simonm1998-02-021-0/+395
Library re-organisation: All libraries now live under ghc/lib, which has the following structure: ghc/lib/std -- all prelude files (libHS.a) ghc/lib/std/cbits ghc/lib/exts -- standard Hugs/GHC extensions (libHSexts.a) -- available with '-fglasgow-exts' ghc/lib/posix -- POSIX library (libHSposix.a) ghc/lib/posix/cbits -- available with '-syslib posix' ghc/lib/misc -- used to be hslibs/ghc (libHSmisc.a) ghc/lib/misc/cbits -- available with '-syslib misc' ghc/lib/concurrent -- Concurrent libraries (libHSconc.a) -- available with '-concurrent' Also, several non-standard prelude modules had their names changed to begin with 'Prel' to reduce namespace pollution. Addr ==> PrelAddr (Addr interface available in 'exts') ArrBase ==> PrelArr CCall ==> PrelCCall (CCall interface available in 'exts') ConcBase ==> PrelConc GHCerr ==> PrelErr Foreign ==> PrelForeign (Foreign interface available in 'exts') GHC ==> PrelGHC IOHandle ==> PrelHandle IOBase ==> PrelIOBase GHCmain ==> PrelMain STBase ==> PrelST Unsafe ==> PrelUnsafe UnsafeST ==> PrelUnsafeST