[darcs-devel] [issue1524] Date conversion breaks down on NetBSD

midnightmagic bugs at darcs.net
Fri Sep 4 17:52:20 UTC 2009


midnightmagic <darcs-bugs at quake.ca> added the comment:

The following patch, as recommended by you kind folks, has worked perfectly:

--- src/Darcs/Patch/Info.hs.orig        2009-01-15 14:53:59.000000000 -0800
+++ src/Darcs/Patch/Info.hs     2009-09-03 14:36:58.000000000 -0700
@@ -150,10 +150,7 @@
           t = BC.pack "TAG "
 
 friendly_d :: B.ByteString -> String
---friendly_d d = calendarTimeToString . readPatchDate . d
-friendly_d d = unsafePerformIO $ do
-    ct <- toCalendarTime $ toClockTime $ readPatchDate d
-    return $ calendarTimeToString ct
+friendly_d d = calendarTimeToString (readPatchDate d)
 
 to_xml :: PatchInfo -> Doc
 to_xml pi =

This is a diff from plain darcs-2.2.0: that Haskell comment in there is in the 
darcs sources originally. I'm still not completely clear on why this works and 
the old one didn't. That is, I don't know what precisely was causing the 
failure: what was it passing to mktime() that NetBSD was choking on?

The reason I ask is that NetBSD mktime includes all the fields in the struct tm 
that Linux does, plus two more optional ones (long tm_gmtoff and char *tm_zone) 
that Linux apparently doesn't, so it shouldn't have any issue with values 
passed to it. mktime is standards-compliant version on both systems.

__________________________________
Darcs bug tracker <bugs at darcs.net>
<http://bugs.darcs.net/issue1524>
__________________________________


More information about the darcs-devel mailing list