@@ -148,10 +148,11 @@ putOlsonPart version putTime (OlsonData transs ttinfos leaps _) = do
148148 ttinfosWithTtype = takeWhile ((<= UTC) . tt_ttype) ttinfosIndexed
149149 abbrStrings = uniq . sort $ map tt_abbr ttinfos
150150 abbrChars = concatMap (++ "\NUL") abbrStrings
151+ abbrAssocs = zip abbrStrings . scanl (+) 0 $
152+ map ((+ 1) . length) abbrStrings
151153 ttinfosIndexed = [TtInfo gmtoff isdst ttype i |
152154 TtInfo gmtoff isdst ttype abbr <- ttinfos,
153− i <- maybeToList . lookup abbr . zip abbrStrings .
154− scanl (+) 0 $ map ((+ 1) . length) abbrStrings]
155+ i <- maybeToList $ lookup abbr abbrAssocs]
155156
156157putPosixTZ :: Maybe String -> Put
157158putPosixTZ posix = do