Internals/Date
Date, timezones, and such
This page describes how does Darcs store dates in named patches.
Source code
in Darcs.Patch.Info:
data PatchInfo = PatchInfo { _piDate :: !B.ByteString
, _piName :: !B.ByteString
, _piAuthor :: !B.ByteString
, _piLog :: ![B.ByteString]
, isInverted :: !Bool
}
deriving (Eq,Ord)
So the date exists as a ByteString.
How is date shown with darcs log
(from Darcs.Patch.Info
):
friendlyD :: B.ByteString -> String
--friendlyD d = calendarTimeToString . readPatchDate . d
friendlyD d = unsafePerformIO $ do
ct <- toCalendarTime $ toClockTime $ readPatchDate d
return $ calendarTimeToString ct
-- | Note: we ignore timezone information in the date string,
-- systematically treating a time as UTC. So if the patch
-- tells me it's 17:00 EST, we're actually treating it as
-- 17:00 UTC, in other words 11:00 EST. This is for
-- backwards compatibility to darcs prior to 2003-11, sometime
-- before 1.0. Fortunately, newer patch dates are written in
-- UTC, so this timezone truncation is harmless for them.
readPatchDate :: B.ByteString -> CalendarTime
readPatchDate = ignoreTz . readUTCDate . BC.unpack
where ignoreTz ct = ct { ctTZ = 0 }
makeFileName
generates patch filenames for OF repositories