+ MATCH(".gas.template", get_index, &uemis_gas_template) ||
+ MATCH(".air.bottom_tank.size", uemis_cylindersize, dive->cylinder + 0) ||
+ MATCH(".air.bottom_tank.oxygen", uemis_percent, dive->cylinder + 0) ||
+ MATCH(".nitrox_1.bottom_tank.size", uemis_cylindersize, dive->cylinder + 1) ||
+ MATCH(".nitrox_1.bottom_tank.oxygen", uemis_percent, dive->cylinder + 1) ||
+ MATCH(".nitrox_2.bottom_tank.size", uemis_cylindersize, dive->cylinder + 2) ||
+ MATCH(".nitrox_2.bottom_tank.oxygen", uemis_percent, dive->cylinder + 2) ||
+ MATCH(".nitrox_2.deco_tank.size", uemis_cylindersize, dive->cylinder + 3) ||
+ MATCH(".nitrox_2.deco_tank.oxygen", uemis_percent, dive->cylinder + 3) ||
+ MATCH(".nitrox_3.bottom_tank.size", uemis_cylindersize, dive->cylinder + 4) ||
+ MATCH(".nitrox_3.bottom_tank.oxygen", uemis_percent, dive->cylinder + 4) ||
+ MATCH(".nitrox_3.deco_tank.size", uemis_cylindersize, dive->cylinder + 5) ||
+ MATCH(".nitrox_3.deco_tank.oxygen", uemis_percent, dive->cylinder + 5) ||
+ MATCH(".nitrox_3.travel_tank.size", uemis_cylindersize, dive->cylinder + 6) ||
+ MATCH(".nitrox_3.travel_tank.oxygen", uemis_percent, dive->cylinder + 6) ||
+ 0;
+}
+
+/*
+ * Uddf specifies ISO 8601 time format.
+ *
+ * There are many variations on that. This handles the useful cases.
+ */
+static void uddf_datetime(char *buffer, void *_when)
+{
+ char c;
+ int y,m,d,hh,mm,ss;
+ time_t *when = _when;
+ struct tm tm = { 0 };
+ int i;
+
+ i = sscanf(buffer, "%d-%d-%d%c%d:%d:%d", &y, &m, &d, &c, &hh, &mm, &ss);
+ if (i == 7)
+ goto success;
+ ss = 0;
+ if (i == 6)
+ goto success;
+
+ i = sscanf(buffer, "%04d%02d%02d%c%02d%02d%02d", &y, &m, &d, &c, &hh, &mm, &ss);
+ if (i == 7)
+ goto success;
+ ss = 0;
+ if (i == 6)
+ goto success;
+bad_date:
+ printf("Bad date time %s\n", buffer);
+ free(buffer);
+ return;
+
+success:
+ if (c != 'T' && c != ' ')
+ goto bad_date;
+ tm.tm_year = y;
+ tm.tm_mon = m - 1;
+ tm.tm_mday = d;
+ tm.tm_hour = hh;
+ tm.tm_min = mm;
+ tm.tm_sec = ss;
+ *when = utc_mktime(&tm);
+ free(buffer);
+}
+
+static int uddf_dive_match(struct dive *dive, const char *name, int len, char *buf)
+{
+ return MATCH(".datetime", uddf_datetime, &dive->when) ||
+ MATCH(".diveduration", duration, &dive->duration) ||
+ MATCH(".greatestdepth", depth, &dive->maxdepth) ||