Hello community,

here is the log from the commit of package ghc-unix-time for openSUSE:Factory 
checked in at 2016-10-19 13:04:45
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-unix-time (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-unix-time.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-unix-time"

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-unix-time/ghc-unix-time.changes      
2016-07-20 09:24:41.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.ghc-unix-time.new/ghc-unix-time.changes 
2016-10-19 13:04:46.000000000 +0200
@@ -1,0 +2,5 @@
+Thu Sep 15 06:42:12 UTC 2016 - [email protected]
+
+- Update to version 0.3.7 revision 0 with cabal2obs.
+
+-------------------------------------------------------------------

Old:
----
  unix-time-0.3.6.tar.gz

New:
----
  unix-time-0.3.7.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ghc-unix-time.spec ++++++
--- /var/tmp/diff_new_pack.THcvg9/_old  2016-10-19 13:04:47.000000000 +0200
+++ /var/tmp/diff_new_pack.THcvg9/_new  2016-10-19 13:04:47.000000000 +0200
@@ -19,15 +19,14 @@
 %global pkg_name unix-time
 %bcond_with tests
 Name:           ghc-%{pkg_name}
-Version:        0.3.6
+Version:        0.3.7
 Release:        0
 Summary:        Unix time parser/formatter and utilities
 License:        BSD-3-Clause
-Group:          System/Libraries
+Group:          Development/Languages/Other
 Url:            https://hackage.haskell.org/package/%{pkg_name}
 Source0:        
https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz
 BuildRequires:  ghc-Cabal-devel
-# Begin cabal-rpm deps:
 BuildRequires:  ghc-binary-devel
 BuildRequires:  ghc-bytestring-devel
 BuildRequires:  ghc-old-time-devel
@@ -40,7 +39,6 @@
 BuildRequires:  ghc-old-locale-devel
 BuildRequires:  ghc-time-devel
 %endif
-# End cabal-rpm deps
 
 %description
 Fast parser/formatter/utilities for Unix time.
@@ -59,20 +57,14 @@
 %prep
 %setup -q -n %{pkg_name}-%{version}
 
-
 %build
 %ghc_lib_build
 
-
 %install
 %ghc_lib_install
 
-
 %check
-%if %{with tests}
-%{cabal} test
-%endif
-
+%cabal_test
 
 %post devel
 %ghc_pkg_recache

++++++ unix-time-0.3.6.tar.gz -> unix-time-0.3.7.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/unix-time-0.3.6/Data/UnixTime/Conv.hs 
new/unix-time-0.3.7/Data/UnixTime/Conv.hs
--- old/unix-time-0.3.6/Data/UnixTime/Conv.hs   2015-10-14 07:10:32.000000000 
+0200
+++ new/unix-time-0.3.7/Data/UnixTime/Conv.hs   2016-09-06 04:46:51.000000000 
+0200
@@ -19,6 +19,9 @@
 import System.Posix.Types (EpochTime)
 import System.Time (ClockTime(..))
 
+-- $setup
+-- >>> import Data.Function (on)
+
 foreign import ccall unsafe "c_parse_unix_time"
         c_parse_unix_time :: CString -> CString -> IO CTime
 
@@ -38,6 +41,7 @@
 -- This is a wrapper for strptime_l().
 -- Many implementations of strptime_l() do not support %Z and
 -- some implementations of strptime_l() do not support %z, either.
+-- 'utMicroSeconds' is always set to 0.
 
 parseUnixTime :: Format -> ByteString -> UnixTime
 parseUnixTime fmt str = unsafePerformIO $
@@ -48,6 +52,7 @@
 -- |
 -- Parsing 'ByteString' to 'UnixTime' interpreting as GMT.
 -- This is a wrapper for strptime_l().
+-- 'utMicroSeconds' is always set to 0.
 --
 -- >>> parseUnixTimeGMT webDateFormat "Thu, 01 Jan 1970 00:00:00 GMT"
 -- UnixTime {utSeconds = 0, utMicroSeconds = 0}
@@ -64,6 +69,8 @@
 -- |
 -- Formatting 'UnixTime' to 'ByteString' in local time.
 -- This is a wrapper for strftime_l().
+-- 'utMicroSeconds' is ignored.
+-- The result depends on the TZ environment variable.
 
 formatUnixTime :: Format -> UnixTime -> IO ByteString
 formatUnixTime fmt t =
@@ -73,9 +80,17 @@
 -- |
 -- Formatting 'UnixTime' to 'ByteString' in GMT.
 -- This is a wrapper for strftime_l().
+-- 'utMicroSeconds' is ignored.
 --
 -- >>> formatUnixTimeGMT webDateFormat $ UnixTime 0 0
 -- "Thu, 01 Jan 1970 00:00:00 GMT"
+-- >>> let ut = UnixTime 100 200
+-- >>> let str = formatUnixTimeGMT "%s" ut
+-- >>> let ut' = parseUnixTimeGMT "%s" str
+-- >>> ((==) `on` utSeconds) ut ut'
+-- True
+-- >>> ((==) `on` utMicroSeconds) ut ut'
+-- False
 
 formatUnixTimeGMT :: Format -> UnixTime -> ByteString
 formatUnixTimeGMT fmt t =
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/unix-time-0.3.6/cbits/conv.c 
new/unix-time-0.3.7/cbits/conv.c
--- old/unix-time-0.3.6/cbits/conv.c    2015-10-14 07:10:32.000000000 +0200
+++ new/unix-time-0.3.7/cbits/conv.c    2016-09-06 04:46:51.000000000 +0200
@@ -15,6 +15,7 @@
 #include <string.h>
 #include <time.h>
 #include <locale.h>
+#include <stdlib.h>
 
 #if THREAD_SAFE
 #if HAVE_XLOCALE_H
@@ -36,6 +37,31 @@
 }
 #endif
 
+/*
+ * Set the value of the TZ environment variable to UTC
+ * and return the old value.
+ */
+char *set_tz_utc() {
+    char *tz;
+    tz = getenv("TZ");
+    setenv("TZ", "", 1);
+    tzset();
+    return tz;
+}
+
+/*
+ * Set the value of the TZ environment variable to tz or
+ * unset the variable if tz is null;
+ */
+void set_tz(char *local_tz) {
+    if (local_tz) {
+      setenv("TZ", local_tz, 1);
+    } else {
+      unsetenv("TZ");
+    }
+    tzset();
+}
+
 time_t c_parse_unix_time(char *fmt, char *src) {
     struct tm dst;
     init_locale();
@@ -54,7 +80,7 @@
  *
  * Copyright (c) 1997 Kungliga Tekniska H.gskolan
  * (Royal Institute of Technology, Stockholm, Sweden).
- * All rights reserved. 
+ * All rights reserved.
  */
 
 static int
@@ -91,13 +117,16 @@
 
 time_t c_parse_unix_time_gmt(char *fmt, char *src) {
     struct tm dst;
+    char *local_tz;
     init_locale();
     memset(&dst, 0, sizeof(struct tm));
+    local_tz = set_tz_utc();
 #if THREAD_SAFE
     strptime_l(src, fmt, &dst, c_locale);
 #else
     strptime(src, fmt, &dst);
 #endif
+    set_tz(local_tz);
     return timegm(&dst);
 }
 
@@ -114,11 +143,18 @@
 
 size_t c_format_unix_time_gmt(char *fmt, time_t src, char* dst, int siz) {
     struct tm tim;
+    char *local_tz;
+    size_t dst_size;
+
     init_locale();
     gmtime_r(&src, &tim);
+
+    local_tz = set_tz_utc();
 #if THREAD_SAFE
-    return strftime_l(dst, siz, fmt, &tim, c_locale);
+    dst_size = strftime_l(dst, siz, fmt, &tim, c_locale);
 #else
-    return strftime(dst, siz, fmt, &tim);
+    dst_size = strftime(dst, siz, fmt, &tim);
 #endif
+    set_tz(local_tz);
+    return dst_size;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/unix-time-0.3.6/test/UnixTimeSpec.hs 
new/unix-time-0.3.7/test/UnixTimeSpec.hs
--- old/unix-time-0.3.6/test/UnixTimeSpec.hs    2015-10-14 07:10:32.000000000 
+0200
+++ new/unix-time-0.3.7/test/UnixTimeSpec.hs    2016-09-06 04:46:51.000000000 
+0200
@@ -5,6 +5,7 @@
 
 import Data.ByteString (ByteString)
 import qualified Data.ByteString.Char8 as BS
+import Data.Function (on)
 import Data.Time
 import Data.Time.Clock.POSIX (posixSecondsToUTCTime)
 import Data.UnixTime
@@ -13,7 +14,7 @@
 import Foreign.Storable (peek, poke)
 import Test.Hspec
 import Test.Hspec.QuickCheck (prop)
-import Test.QuickCheck
+import Test.QuickCheck hiding ((===))
 
 #if !MIN_VERSION_time(1,5,0)
 import System.Locale (defaultTimeLocale)
@@ -42,12 +43,17 @@
             let model = formatMailModel utcTime timeZone
             ours `shouldReturn` model
 
-    describe "parseUnixTimeGMT & formatUnixTimeGMT" $
-        prop "inverses the result" $ \ut@(UnixTime sec _) ->
+    describe "parseUnixTimeGMT & formatUnixTimeGMT" $ do
+        let (===) = (==) `on` utSeconds
+        prop "inverses the result" $ \ut ->
             let dt  = formatUnixTimeGMT webDateFormat ut
                 ut' = parseUnixTimeGMT  webDateFormat dt
                 dt' = formatUnixTimeGMT webDateFormat ut'
-            in ut' == UnixTime sec 0 && dt == dt'
+            in ut === ut' && dt == dt'
+        prop "inverses the result (2)" $ \ut ->
+            let str = formatUnixTimeGMT "%s" ut
+                ut' = parseUnixTimeGMT "%s" str
+            in ut === ut'
 
     describe "addUnixDiffTime & diffUnixTime" $
         prop "invrses the result" $ \(ut0, ut1) ->
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/unix-time-0.3.6/unix-time.cabal 
new/unix-time-0.3.7/unix-time.cabal
--- old/unix-time-0.3.6/unix-time.cabal 2015-10-14 07:10:32.000000000 +0200
+++ new/unix-time-0.3.7/unix-time.cabal 2016-09-06 04:46:51.000000000 +0200
@@ -1,5 +1,5 @@
 Name:                   unix-time
-Version:                0.3.6
+Version:                0.3.7
 Author:                 Kazu Yamamoto <[email protected]>
 Maintainer:             Kazu Yamamoto <[email protected]>
 License:                BSD3


Reply via email to