aboutsummaryrefslogtreecommitdiff
path: root/lib/GTFS.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/GTFS.hs')
-rw-r--r--lib/GTFS.hs14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/GTFS.hs b/lib/GTFS.hs
index af4d03b..2bcfdd5 100644
--- a/lib/GTFS.hs
+++ b/lib/GTFS.hs
@@ -153,8 +153,18 @@ instance Show Time where
show (Time seconds _ _) = ""
+|pad (seconds `div` 3600)|+":"
+|pad ((seconds `mod` 3600) `div` 60)|+
- {- if seconds `mod` 60 /= 0 then -}":"+|pad (seconds `mod` 60)|+""
- -- else ""
+ if seconds `mod` 60 /= 0 then":"+|pad (seconds `mod` 60)|+""
+ else ""
+ where
+ pad num =
+ if length str < 2 then "0"<>str else str
+ where str = show num
+
+showTimeWithSeconds :: Time -> String
+showTimeWithSeconds (Time seconds _ _) = ""
+ +|pad (seconds `div` 3600)|+":"
+ +|pad ((seconds `mod` 3600) `div` 60)|+
+ ":"+|pad (seconds `mod` 60)|+""
where
pad num =
if length str < 2 then "0"<>str else str