Before it gets too late to change this, are we absolutely sure that DDMMYYYY is the best way to go? Among other things, DDMM is an unusual or confusing order for many people outside of europe. A useful short discussion of ISO8601 is here. The most important reasons to use ISO date format in my experience are twofold:
1) Unambiguous. I deal with people from the UK and the US on a daily basis, and an unambiguous date format is the difference between effing nightmare and ... not effing nightmare
2) Sortable. Working through a huge directory listing to find "the nearest trace to a specific date" is a nightmare
Specifying time - what use will that be, other than to separate tracks from the same day? If the time is used to mean anything, then should it be converted to UTC? If not, then a TZ suffix is important.
More on the list of "nightmare things I have to deal with on a regular basis"
Gary
PS Apologies if this is in the realm of the bikeshed, but date formats are a particular bugbear to me.
OBDGPSLogger, for logging OBDII and/or GPS data
OBDSim, an OBDII/ELM327 software simulator
mp3car forums: obdgpslogger, obdsim
The gist of that iso link is here:
Basically to comply with the 'full' ISO format you need to:
- Use 4-digit years when storing or printing dates.
- Use the order Year-Month-Day for the date, i.e. biggest first.
- Use leading zeroes on the digits 00 - 09 for the month and day numbers.
- Always put the Date BEFORE the Time.
- Use the order hours:minutes:seconds for times.
- Use the 24-hour format for times (not the 12-hour am/pm).
- Use a leading zero on hour, minute and second for digits 00 - 09 inclusive.
- Use UT time scale for dates and times if transferring data internationally.
- When printing dates and times use the '-' and ':' separators.
e.g. 1996-12-31 23:59:59 is the last second of last year.
- When storing dates you can strip off the separators and store as a 32-bit
number, an ASCII string, packed BCD or whatever you like. Sort algorithms
are much easier with this YMD format.
- Times can be treated the same way (sorted or stored), as in the discussion
for dates.
Correct me if I'm wrong, but didn't I read in the NMEA information that the timestamps used in sentencing is UTC? This is an important bit of info for parsing the files.
And I'm all-for the YYYYMMDD and HHMMSS formats! As for naming conventions, is the filename for first recorded second?
Play with it, 'til it's broke.
Sounds right. It's worth noting that : in filenames is bad karma [no matter what the standards may say], so I always store the time packed without separators.Basically to comply with the 'full' ISO format you need to:
- Use 4-digit years when storing or printing dates.
- Use the order Year-Month-Day for the date, i.e. biggest first.
- Use leading zeroes on the digits 00 - 09 for the month and day numbers.
- Always put the Date BEFORE the Time.
- Use the order hours:minutes:seconds for times.
- Use the 24-hour format for times (not the 12-hour am/pm).
- Use a leading zero on hour, minute and second for digits 00 - 09 inclusive.
- Use UT time scale for dates and times if transferring data internationally.
- When printing dates and times use the '-' and ':' separators.
e.g. 1996-12-31 23:59:59 is the last second of last year.
- When storing dates you can strip off the separators and store as a 32-bit
number, an ASCII string, packed BCD or whatever you like. Sort algorithms
are much easier with this YMD format.
- Times can be treated the same way (sorted or stored), as in the discussion
for dates.
A simpler rule to remember ordering is "it's big endian" - store units biggest-first. Eg, years are bigger than months, and days are bigger than hours.
Yes, grabbing the timestamp exactly as the NMEA sentence mentions it is UTC, but a lot of userland programs will be converting to local time, so beware.
Gary (-;
OBDGPSLogger, for logging OBDII and/or GPS data
OBDSim, an OBDII/ELM327 software simulator
mp3car forums: obdgpslogger, obdsim
+1 for UTC. Let the user convert it. Settling on a single timestamp will make sorting and ordering it much easier. Agree also with the ISO format.
Want to:
-Find out about the new iBug iPad install?
-Find out about carPC's in just 5 minutes? View the Car PC 101 video
Bookmarks