]> gitweb.factorcode.org Git - factor.git/commitdiff
metar: fix for timestamps like "2124" meaning "2200".
authorJohn Benediktsson <mrjbq7@gmail.com>
Tue, 20 Nov 2018 19:41:18 +0000 (11:41 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Tue, 20 Nov 2018 19:41:18 +0000 (11:41 -0800)
extra/metar/metar.factor

index fc6df7b008634ca9f7691707d06fdcbce96e4e18..e4a98b8e9947675d44ce870e53cd0242a4badd68 100644 (file)
@@ -141,7 +141,11 @@ MEMO: glossary ( -- assoc )
 : parse-timestamp ( str -- str' )
     [ now [ year>> ] [ month>> ] bi ] dip
     2 cut 2 cut 2 cut drop [ string>number ] tri@
-    0 instant <timestamp> timestamp>rfc822 ;
+    over 24 = [
+        [ drop 0 ] dip 0 instant <timestamp> 1 days time+
+    ] [
+        0 instant <timestamp>
+    ] if timestamp>rfc822 ;
 
 CONSTANT: compass-directions H{
     { 0.0 "N" }