time 1.5 → 1.5.0.1
raw patch · 9 files changed
+41/−18 lines, 9 filesdep ~basedep ~deepseqdep ~timesetup-changed
Dependency ranges changed: base, deepseq, time
Files
- Setup.hs +5/−1
- lib/Data/Time/Calendar/WeekDate.hs +10/−11
- lib/Data/Time/Clock/CTimeval.hs +4/−0
- lib/Data/Time/Clock/Scale.hs +2/−1
- lib/Data/Time/Clock/UTC.hs +2/−1
- lib/Data/Time/Format/Locale.hs +1/−1
- lib/Data/Time/LocalTime/TimeZone.hs +4/−0
- lib/cbits/HsTime.c +10/−0
- time.cabal +3/−3
Setup.hs view
@@ -1,2 +1,6 @@+module Main (main) where+ import Distribution.Simple-main = defaultMain++main :: IO ()+main = defaultMainWithHooks autoconfUserHooks
lib/Data/Time/Calendar/WeekDate.hs view
@@ -9,21 +9,20 @@ -- Note that \"Week\" years are not quite the same as Gregorian years, as the first day of the year is always a Monday. -- The first week of a year is the first week to contain at least four days in the corresponding Gregorian year. toWeekDate :: Day -> (Integer,Int,Int)-toWeekDate date@(ModifiedJulianDay mjd) = (y1,fromInteger (w1 + 1),fromInteger (mod d 7) + 1) where+toWeekDate date@(ModifiedJulianDay mjd) = (y1,fromInteger (w1 + 1),fromInteger d_mod_7 + 1) where+ (d_div_7, d_mod_7) = d `divMod` 7 (y0,yd) = toOrdinalDate date d = mjd + 2 foo :: Integer -> Integer foo y = bar (toModifiedJulianDay (fromOrdinalDate y 6))- bar k = (div d 7) - (div k 7)- w0 = bar (d - (toInteger yd) + 4)- (y1,w1) = if w0 == -1- then (y0 - 1,foo (y0 - 1))- else if w0 == 52- then if (foo (y0 + 1)) == 0- then (y0 + 1,0)- else (y0,w0)- else (y0,w0)-+ bar k = d_div_7 - k `div` 7+ (y1,w1) = case bar (d - toInteger yd + 4) of+ -1 -> (y0 - 1, foo (y0 - 1))+ 52 -> if foo (y0 + 1) == 0+ then (y0 + 1, 0)+ else (y0, 52)+ w0 -> (y0, w0)+ -- | convert from ISO 8601 Week Date format. First argument is year, second week number (1-52 or 53), third day of week (1 for Monday to 7 for Sunday). -- Invalid week and day values will be clipped to the correct range. fromWeekDate :: Integer -> Int -> Int -> Day
lib/Data/Time/Clock/CTimeval.hs view
@@ -4,7 +4,11 @@ #ifndef mingw32_HOST_OS -- All Unix-specific, this +#if __GLASGOW_HASKELL__ >= 709+import Foreign+#else import Foreign.Safe+#endif import Foreign.C data CTimeval = MkCTimeval CLong CLong
lib/Data/Time/Clock/Scale.hs view
@@ -50,7 +50,8 @@ ) -- necessary because H98 doesn't have "cunning newtype" derivation-instance NFData DiffTime -- FIXME: Data.Fixed had no NFData instances yet at time of writing+instance NFData DiffTime where -- FIXME: Data.Fixed had no NFData instances yet at time of writing+ rnf dt = seq dt () -- necessary because H98 doesn't have "cunning newtype" derivation instance Enum DiffTime where
lib/Data/Time/Clock/UTC.hs view
@@ -70,7 +70,8 @@ ) -- necessary because H98 doesn't have "cunning newtype" derivation-instance NFData NominalDiffTime -- FIXME: Data.Fixed had no NFData instances yet at time of writing+instance NFData NominalDiffTime where -- FIXME: Data.Fixed had no NFData instances yet at time of writing+ rnf ndt = seq ndt () instance Enum NominalDiffTime where succ (MkNominalDiffTime a) = MkNominalDiffTime (succ a)
lib/Data/Time/Format/Locale.hs view
@@ -14,7 +14,7 @@ import Data.Time.LocalTime data TimeLocale = TimeLocale {- -- |full and abbreviated week days+ -- |full and abbreviated week days, starting with Sunday wDays :: [(String, String)], -- |full and abbreviated months months :: [(String, String)],
lib/Data/Time/LocalTime/TimeZone.hs view
@@ -17,7 +17,11 @@ import Data.Time.Clock import Data.Time.Clock.POSIX +#if __GLASGOW_HASKELL__ >= 709+import Foreign+#else import Foreign.Safe+#endif import Foreign.C import Control.DeepSeq import Data.Typeable
lib/cbits/HsTime.c view
@@ -3,7 +3,17 @@ long int get_current_timezone_seconds (time_t t,int* pdst,char const* * pname) {+#if defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32)+ // When compiling with MinGW (which does not provide a full POSIX+ // layer as opposed to CygWin) it's better to use the CRT's+ // underscore-prefixed `_tzset()` variant to avoid linker issues+ // as Microsoft considers the POSIX named `tzset()` function+ // deprecated (see http://msdn.microsoft.com/en-us/library/ms235384.aspx)+ _tzset();+#else tzset();+#endif+ #if HAVE_LOCALTIME_R struct tm tmd; struct tm* ptm = localtime_r(&t,&tmd);
time.cabal view
@@ -1,5 +1,5 @@ name: time-version: 1.5+version: 1.5.0.1 stability: stable license: BSD3 license-file: LICENSE@@ -95,7 +95,7 @@ type: exitcode-stdio-1.0 build-depends: base,- time == 1.5+ time == 1.5.0.1 main-is: ShowDefaultTZAbbreviations.hs test-suite tests@@ -117,7 +117,7 @@ build-depends: base, deepseq,- time == 1.5,+ time == 1.5.0.1, QuickCheck >= 2.5.1, test-framework >= 0.8, test-framework-quickcheck2 >= 0.3,