Safecast / Safecast-Air

Repo for all things related to Safecast's air quality monitoring platform.
5 stars 5 forks source link

Datetime formatting may or may not be parser-friendly #16

Open rayozzie opened 7 years ago

rayozzie commented 7 years ago

Will, while trying to figure out a parsing error in Rob's safecast gateway, I stumbled across the fact that the dates generated by safecast-air look different than the ones that come in from other devices.

Specifically, both the dates and the times seem to be lacking a leading zero. I am NOT SURE if this is required by any of the date parsers, but I think it might be good practice and helpful if you would change your %d's to %02d's, if you know what I mean.

"2017-3-5T0:5:38Z" is an example of what I see coming out of safecast-air. I've never seen a second that is other than 38 or 56 in my data, but you might want to verify that field also for %02d.

"2017-03-05T00:05:38Z" is an example of what I see coming out of pointcast and out of golang's date libraries.

Thanks.

thinrope commented 7 years ago

Yep, all must be exchanged in ISO-8601 (by design spec) https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations

See https://github.com/Safecast/Safecast-Air/blob/e946836cb045cf7c46a43dc2478c8233c31c4d20/firmware/libraries/gps_monitor/gps_data.cpp#L37

willdickson commented 7 years ago

This should be fixed now - thanks!