X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=dive.c;h=cb94e7925ce01695659ac1c5de33da192e77ef30;hb=d906c82f31c5406b6debe0df88cb49b916cd6ced;hp=53a874b9b0950356500fa0835a8b4c9e3b4b9deb;hpb=a487f6c9314f0fe5e4173b670d9653067285da21;p=ext%2Fsubsurface.git diff --git a/dive.c b/dive.c index 53a874b..cb94e79 100644 --- a/dive.c +++ b/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;