aboutsummaryrefslogtreecommitdiff
path: root/lib/GTFS.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/GTFS.hs')
-rw-r--r--lib/GTFS.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/GTFS.hs b/lib/GTFS.hs
index 3935caa..b83db0f 100644
--- a/lib/GTFS.hs
+++ b/lib/GTFS.hs
@@ -127,6 +127,12 @@ toSeconds (Time seconds _ _) tzseries refday =
where timezone = timeZoneFromSeries tzseries reftime
reftime = UTCTime refday (fromInteger $ toInteger seconds)
+-- | convert a time to a UTCTime, using the timezone valid on the refday.
+-- Note that this will may fail to be correct in case of trips going across midnight
+toUTC :: Time -> TimeZoneSeries -> Day -> UTCTime
+toUTC time tzseries refday =
+ UTCTime refday (fromInteger $ toInteger $ unSeconds $ toSeconds time tzseries refday)
+
-- | Times in GTFS are given without timezone info, which is handled
-- seperately (as an attribute of the stop / the agency). We attach that information