mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Use unit functions to get column headers, add unit function for pressure
Finally getting more consistent overall in how we convert between the different units and how we decide which units to display. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
a487f6c931
commit
b26ca781b8
4 changed files with 34 additions and 39 deletions
24
dive.c
24
dive.c
|
@ -29,6 +29,30 @@ void add_event(struct dive *dive, int time, int type, int flags, int value, cons
|
|||
remember_event(name);
|
||||
}
|
||||
|
||||
int get_pressure_units(unsigned int mb, const char **units)
|
||||
{
|
||||
int pressure;
|
||||
const char* unit;
|
||||
|
||||
switch (output_units.pressure) {
|
||||
case PASCAL:
|
||||
pressure = mb * 100;
|
||||
unit = "pascal";
|
||||
break;
|
||||
case BAR:
|
||||
pressure = (mb + 500) / 1000;
|
||||
unit = "bar";
|
||||
break;
|
||||
case PSI:
|
||||
pressure = mbar_to_PSI(mb);
|
||||
unit = "psi";
|
||||
break;
|
||||
}
|
||||
if (units)
|
||||
*units = unit;
|
||||
return pressure;
|
||||
}
|
||||
|
||||
double get_temp_units(unsigned int mk, const char **units)
|
||||
{
|
||||
double deg;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue