summaryrefslogtreecommitdiff
path: root/standalone/android/haskell-patches/unix-time_hack-for-Bionic.patch
blob: 3f7d2aae70504f4fa77dd402d23e4ed5bef5e927 (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
51
52
53
54
55
56
From da127aa3b2c6cbf679950eb593eb8c88384cc26b Mon Sep 17 00:00:00 2001
From: dummy <dummy@example.com>
Date: Thu, 2 Jul 2015 20:34:05 +0000
Subject: [PATCH] hack for bionic

---
 Data/UnixTime/Types.hsc | 12 ------------
 cbits/conv.c            |  2 +-
 2 files changed, 1 insertion(+), 13 deletions(-)

diff --git a/Data/UnixTime/Types.hsc b/Data/UnixTime/Types.hsc
index 6253b27..fb5b3fa 100644
--- a/Data/UnixTime/Types.hsc
+++ b/Data/UnixTime/Types.hsc
@@ -12,8 +12,6 @@ import Data.Binary
 
 #include <sys/time.h>
 
-#let alignment t = "%lu", (unsigned long)offsetof(struct {char x__; t (y__); }, y__)
-
 -- |
 -- Data structure for Unix time.
 --
@@ -33,16 +31,6 @@ data UnixTime = UnixTime {
   , utMicroSeconds :: {-# UNPACK #-} !Int32
   } deriving (Eq,Ord,Show)
 
-instance Storable UnixTime where
-    sizeOf _    = (#size struct timeval)
-    alignment _ = (#alignment struct timeval)
-    peek ptr    = UnixTime
-            <$> (#peek struct timeval, tv_sec)  ptr
-            <*> (#peek struct timeval, tv_usec) ptr
-    poke ptr ut = do
-            (#poke struct timeval, tv_sec)  ptr (utSeconds ut)
-            (#poke struct timeval, tv_usec) ptr (utMicroSeconds ut)
-
 #if __GLASGOW_HASKELL__ >= 704
 instance Binary UnixTime where
         put (UnixTime (CTime sec) msec) = do
diff --git a/cbits/conv.c b/cbits/conv.c
index 669cfda..8fa5f9a 100644
--- a/cbits/conv.c
+++ b/cbits/conv.c
@@ -98,7 +98,7 @@ time_t c_parse_unix_time_gmt(char *fmt, char *src) {
 #else
     strptime(src, fmt, &dst);
 #endif
-    return timegm(&dst);
+    return NULL; /* timegm(&dst); (not in Bionic) */
 }
 
 size_t c_format_unix_time(char *fmt, time_t src, char* dst, int siz) {
-- 
2.1.4