[Pkg-haskell-commits] [SCM] haskell-testpack branch, master, updated. debian/1.0.2-1-4-gb0d6b36
John Goerzen
jgoerzen at complete.org
Fri Apr 23 14:54:17 UTC 2010
The following commit has been merged in the master branch:
commit 686d7279e1d3020264c1710d971376b2cda9da0f
Author: John Goerzen <jgoerzen at complete.org>
Date: Wed Jan 26 23:37:51 2005 +0100
Chcekpointing
Keywords:
(jgoerzen at complete.org--projects/missingh--head--0.7--patch-175)
diff --git a/ChangeLog b/ChangeLog
index 662dafc..d32b44c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,23 @@
# arch-tag: automatic-ChangeLog--jgoerzen at complete.org--projects/missingh--head--0.7
#
+2005-01-26 16:37:51 GMT John Goerzen <jgoerzen at complete.org> patch-175
+
+ Summary:
+ Chcekpointing
+ Revision:
+ missingh--head--0.7--patch-175
+
+
+ modified files:
+ ChangeLog Makefile MissingH.cabal README debian/changelog
+ debian/control libsrc/MissingH/Time.hs testsrc/Timetest.hs
+
+ renamed files:
+ Setup.description
+ ==> MissingH.cabal
+
+
2005-01-21 01:34:53 GMT John Goerzen <jgoerzen at complete.org> patch-174
Summary:
diff --git a/Makefile b/Makefile
index 717456c..7f6c6ed 100644
--- a/Makefile
+++ b/Makefile
@@ -25,7 +25,7 @@ OBJS := $(O1:.lhs=.o)
all: libmissingH.a
-setup: Setup.lhs Setup.description
+setup: Setup.lhs MissingH.cabal
ghc -package Cabal Setup.lhs -o setup
libmissingH.a: $(OBJS)
diff --git a/Setup.description b/MissingH.cabal
similarity index 97%
rename from Setup.description
rename to MissingH.cabal
index 25dacaa..b587099 100644
--- a/Setup.description
+++ b/MissingH.cabal
@@ -5,7 +5,7 @@ License: GPL
Maintainer: John Goerzen <jgoerzen at complete.org>
Stability: Alpha
Copyright: Copyright (c) 2004 John Goerzen
-Modules: MissingH.IO, MissingH.IO.Binary, MissingH.List,
+Exposed-Modules: MissingH.IO, MissingH.IO.Binary, MissingH.List,
MissingH.Logging, MissingH.Logging.Handler,
MissingH.Logging.Handler.Simple, MissingH.Logging.Handler.Syslog,
MissingH.Logging.Logger,
diff --git a/README b/README
index 8e8717b..1abc3be 100644
--- a/README
+++ b/README
@@ -130,6 +130,8 @@ MissingH.Str * Leading/trailing whitespace removal
MissingH.Threads * Threaded callbacks
+MissingH.Time * Utilities for working with times and dates
+
Wash.Mail.* * Generate or parse e-mail messages
* Full support for headers and MIME
diff --git a/debian/changelog b/debian/changelog
index 566f556..2b8d62f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+missingh (0.8.1) unstable; urgency=low
+
+ * Updated to Cabal 0.4.
+ * New module: MissingH.Time.
+
+ -- John Goerzen <jgoerzen at complete.org> Wed, 26 Jan 2005 10:34:22 -0600
+
missingh (0.8.0) unstable; urgency=low
* New HVIO, HVFS modules.
diff --git a/debian/control b/debian/control
index 24e1b89..ebd98a4 100644
--- a/debian/control
+++ b/debian/control
@@ -1,7 +1,7 @@
Source: missingh
Priority: optional
Maintainer: John Goerzen <jgoerzen at complete.org>
-Build-Depends: debhelper (>= 4.0.0), ghc6 (>= 6.2.2), ghc6 (<< 6.2.3), haskell-devscripts (>= 0.5.2), libghc6-hunit-dev
+Build-Depends: debhelper (>= 4.0.0), ghc6 (>= 6.2.2), ghc6 (<< 6.2.3), haskell-devscripts (>= 0.5.3), libghc6-hunit-dev
Build-Depends-Indep: debhelper (>= 4.0.0), haddock, hugs, haskell-devscripts (>= 0.5.2), libhugs-hunit
Standards-Version: 3.6.1
Section: devel
diff --git a/libsrc/MissingH/Time.hs b/libsrc/MissingH/Time.hs
index cd44bfe..d6295b9 100644
--- a/libsrc/MissingH/Time.hs
+++ b/libsrc/MissingH/Time.hs
@@ -26,53 +26,62 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Stability : provisional
Portability: portable
-This module provides various helpful utilities for dealing with times and
+This module provides various Haskell utilities for dealing with times and
dates.
Written by John Goerzen, jgoerzen\@complete.org
-}
module MissingH.Time(
- calendarTimeUTCToEpoch,
- calendarTimeToEpoch,
- timeDiffToSecs
+ timelocal,
+ timegm,
+ timeDiffToSecs,
+ epoch
)
where
import System.Time
-{- | January 1, 1970 represented as a CalendarTime. -}
+{- | January 1, 1970, midnight, UTC, represented as a CalendarTime. -}
epoch :: CalendarTime
epoch = CalendarTime { ctYear = 1970, ctMonth = January,
ctDay = 1, ctHour = 0, ctMin = 0, ctSec = 0,
ctPicosec = 0, ctWDay = Thursday, ctYDay = 0,
- ctTZName = "", ctTZ = 0, ctIsDST = False}
+ ctTZName = "UTC", ctTZ = 0, ctIsDST = False}
{- | Converts the specified CalendarTime (see System.Time) to seconds-since-epoch time.
-The conversion is naive with respect to timezones. All timezone and DST information
-in the CalendarTime object is silently ignored. The epoch is assumed to be
-00:00 on January 1, 1970.
+This conversion does respect the timezone specified on the input object.
+If you want a conversion from UTC, specify ctTZ = 0 and ctIsDST = False.
-One convenient side-effect of this zone-agnostic approach is that you will
-get proper results out of this function whether or not you pass it UTC data,
-since effectively it is computing a difference. -}
+When called like that, the behavior is equivolent to the GNU C function
+timegm(). Unlike the C library, Haskell's CalendarTime supports
+timezone information, so if such information is specified, it will impact
+the result.
+-}
-calendarTimeUTCToEpoch :: CalendarTime -> Integer
-calendarTimeUTCToEpoch ct =
+timegm :: CalendarTime -> Integer
+timegm ct =
timeDiffToSecs (diffClockTimes (toClockTime ct) (toClockTime epoch))
-{- | Like 'calendarTimeUTCToEpoch', but works on local times.
+{- | Converts the specified CalendarTime (see System.Time) to
+seconds-since-epoch format.
+
+The input CalendarTime is assumed to be the time as given in your local
+timezone. All timezone and DST fields in the object are ignored.
-Caveat: may be inaccurate right around the change to/from DST.
+This behavior is equivolent to the timelocal() and mktime() functions that
+C programmers are accustomed to.
-Ignores same fields as 'calendarTimeUTCToEpoch'.
+Please note that the behavior for this function during the hour immediately
+before or after a DST switchover may produce a result with a different hour
+than you expect.
-}
-calendarTimeToEpoch :: CalendarTime -> IO Integer
-calendarTimeToEpoch ct =
+timelocal :: CalendarTime -> IO Integer
+timelocal ct =
do guessct <- toCalendarTime guesscl
let newct = ct {ctTZ = ctTZ guessct}
- return $ calendarTimeUTCToEpoch newct
+ return $ timegm newct
where guesscl = toClockTime ct
{- | Converts the given timeDiff to the number of seconds it represents.
diff --git a/testsrc/Timetest.hs b/testsrc/Timetest.hs
index f4ff878..fccbbc7 100644
--- a/testsrc/Timetest.hs
+++ b/testsrc/Timetest.hs
@@ -26,7 +26,7 @@ base =CalendarTime {ctYear = 2005, ctMonth = January, ctDay = 21,
ctPicosec = 0, ctWDay = Sunday, ctYDay = 0,
ctTZName = "", ctTZ = 0, ctIsDST = False}
test_ctu2e =
- let f base exp = TestLabel (show base) $ TestCase $ exp @=? calendarTimeUTCToEpoch base in
+ let f base exp = TestLabel (show base) $ TestCase $ exp @=? timegm base in
[
f (base {ctYear = 2005, ctMonth = January, ctDay = 21,
ctHour = 1, ctMin = 1, ctSec = 20})
@@ -40,7 +40,7 @@ test_ctu2e =
test_ct2e =
let f base exp = TestLabel (show base) $ TestCase $
- do r <- calendarTimeToEpoch base
+ do r <- timelocal base
exp @=? r in
[
f (base {ctYear = 2005, ctMonth = January, ctDay = 20,
@@ -52,5 +52,5 @@ test_ct2e =
]
tests = TestList [TestLabel "ctu2e" (TestList test_ctu2e),
- TestLabel "ct2e" (TestList test_ct2e)
+# TestLabel "ct2e" (TestList test_ct2e)
]
\ No newline at end of file
--
haskell-testpack
More information about the Pkg-haskell-commits
mailing list