Never return -0 as temperature
[metar.git] / src / metar.lua
index bc2045f..c092cd0 100644 (file)
@@ -464,7 +464,9 @@ end
 
 local function parse_metar_temperature(temperature, dewpoint)
        temperature = temperature:gsub('^M', '-')
+       temperature = temperature:gsub('^-0+$', '0')
        dewpoint = dewpoint:gsub('^M', '-')
+       dewpoint = dewpoint:gsub('^-0+$', '0')
        return { temperature = tonumber(temperature), dewpoint = tonumber(dewpoint) }
 end