summaryrefslogtreecommitdiff
path: root/community-testing/haskell-tar/0001-update-changed-time-code-for-ghc-7.6.1.patch
blob: b8c2264bccee26a466e521e750ed1aa7c1f38d36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
From bd14edd6240c72baa22822338fc872e6827af680 Mon Sep 17 00:00:00 2001
From: Thomas Dziedzic <gostrc@gmail.com>
Date: Tue, 11 Sep 2012 06:24:09 -0700
Subject: [PATCH] update changed time code for ghc 7.6.1

---
 Codec/Archive/Tar/Pack.hs | 9 +++++----
 tar.cabal                 | 2 +-
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/Codec/Archive/Tar/Pack.hs b/Codec/Archive/Tar/Pack.hs
index 8e43091..0af6103 100644
--- a/Codec/Archive/Tar/Pack.hs
+++ b/Codec/Archive/Tar/Pack.hs
@@ -28,8 +28,8 @@ import qualified System.FilePath as FilePath.Native
 import System.Directory
          ( getDirectoryContents, doesDirectoryExist, getModificationTime
          , Permissions(..), getPermissions )
-import System.Time
-         ( ClockTime(..) )
+import Data.Time.Clock.POSIX
+         ( utcTimeToPOSIXSeconds )
 import System.IO
          ( IOMode(ReadMode), openBinaryFile, hFileSize )
 import System.IO.Unsafe (unsafeInterleaveIO)
@@ -170,5 +170,6 @@ recurseDirectories base (dir:dirs) = unsafeInterleaveIO $ do
 
 getModTime :: FilePath -> IO EpochTime
 getModTime path = do
-  (TOD s _) <- getModificationTime path
-  return $! fromIntegral s
+  utcTime <- getModificationTime path
+  let s = truncate . utcTimeToPOSIXSeconds $ utcTime
+  return $! s
diff --git a/tar.cabal b/tar.cabal
index e748b07..d85b0da 100644
--- a/tar.cabal
+++ b/tar.cabal
@@ -25,7 +25,7 @@ source-repository head
 
 library
   build-depends: base >= 3 && < 5, filepath,
-                 directory, old-time, bytestring
+                 directory, bytestring, time
 
   exposed-modules:
     Codec.Archive.Tar
-- 
1.7.12