+/*
+ * pressure_to_depth: In centibar. And when converting to
+ * depth, I'm just going to always use saltwater, because I
+ * think "true depth" is just stupid. From a diving standpoint,
+ * "true depth" is pretty much completely pointless, unless
+ * you're doing some kind of underwater surveying work.
+ *
+ * So I give water depths in "pressure depth", always assuming
+ * salt water. So one atmosphere per 10m.
+ */
+static int pressure_to_depth(uint16_t value)
+{
+ double atm, cm;
+
+ atm = (value / 100.0) / 1.01325;
+ cm = 100 * atm + 0.5;
+ return( (cm > 0) ? 10 * (long)cm : 0);
+}