Refactoring: Improve Naming of FRACTION and SIGNED_FRAC defines.

Make it more obvious that the FRACTION and SIGNED_FRAC defines return a
tuple / triplet of values.

Fixes https://github.com/subsurface/subsurface/pull/4171#discussion_r1585941133

Complained-about-by: @bstoeger
Signed-off-by: Michael Keller <github@ike.ch>
This commit is contained in:
Michael Keller 2024-05-01 21:01:06 +12:00 committed by bstoeger
parent 32a08735c3
commit e65c7cedc8
16 changed files with 57 additions and 57 deletions

View file

@ -181,7 +181,7 @@ void export_TeX(const char *filename, bool selected_only, bool plain, ExportCall
site ? put_format(&buf, "\\def\\%sgpslon{%f}\n", ssrf, site->location.lon.udeg / 1000000.0) : put_format(&buf, "\\def\\gpslon{}\n");
put_format(&buf, "\\def\\%scomputer{%s}\n", ssrf, dive->dc.model);
put_format(&buf, "\\def\\%scountry{%s}\n", ssrf, country ?: "");
put_format(&buf, "\\def\\%stime{%u:%02u}\n", ssrf, FRACTION(dive->duration.seconds, 60));
put_format(&buf, "\\def\\%stime{%u:%02u}\n", ssrf, FRACTION_TUPLE(dive->duration.seconds, 60));
put_format(&buf, "\n%% Dive Profile Details:\n");
dive->maxtemp.mkelvin ? put_format(&buf, "\\def\\%smaxtemp{%.1f\\%stemperatureunit}\n", ssrf, get_temp_units(dive->maxtemp.mkelvin, &unit), ssrf) : put_format(&buf, "\\def\\%smaxtemp{}\n", ssrf);

View file

@ -561,7 +561,7 @@ int init_decompression(struct deco_state *ds, const struct dive *dive, bool in_p
}
add_segment(ds, surface_pressure, air, surface_time, 0, OC, prefs.decosac, in_planner);
#if DECO_CALC_DEBUG & 2
printf("Tissues after surface intervall of %d:%02u:\n", FRACTION(surface_time, 60));
printf("Tissues after surface intervall of %d:%02u:\n", FRACTION_TUPLE(surface_time, 60));
dump_tissues(ds);
#endif
}
@ -598,7 +598,7 @@ int init_decompression(struct deco_state *ds, const struct dive *dive, bool in_p
}
add_segment(ds, surface_pressure, air, surface_time, 0, OC, prefs.decosac, in_planner);
#if DECO_CALC_DEBUG & 2
printf("Tissues after surface intervall of %d:%02u:\n", FRACTION(surface_time, 60));
printf("Tissues after surface intervall of %d:%02u:\n", FRACTION_TUPLE(surface_time, 60));
dump_tissues(ds);
#endif
}

View file

@ -102,8 +102,8 @@ static void dump_pr_track(int cyl, pr_track_t *track_pr)
printf(" start %f end %f t_start %d:%02d t_end %d:%02d pt %d\n",
mbar_to_PSI(list->start),
mbar_to_PSI(list->end),
FRACTION(list->t_start, 60),
FRACTION(list->t_end, 60),
FRACTION_TUPLE(list->t_start, 60),
FRACTION_TUPLE(list->t_end, 60),
list->pressure_time);
list = list->next;
}

View file

@ -441,7 +441,7 @@ sample_cb(dc_sample_type_t type, const dc_sample_value_t *pvalue, void *userdata
break;
#ifdef DEBUG_DC_VENDOR
case DC_SAMPLE_VENDOR:
printf(" <vendor time='%u:%02u' type=\"%u\" size=\"%u\">", FRACTION(sample->time.seconds, 60),
printf(" <vendor time='%u:%02u' type=\"%u\" size=\"%u\">", FRACTION_TUPLE(sample->time.seconds, 60),
value.vendor.type, value.vendor.size);
for (int i = 0; i < value.vendor.size; ++i)
printf("%02X", ((unsigned char *)value.vendor.data)[i]);

View file

@ -219,7 +219,7 @@ void put_depth(struct membuffer *b, depth_t depth, const char *pre, const char *
void put_duration(struct membuffer *b, duration_t duration, const char *pre, const char *post)
{
if (duration.seconds)
put_format(b, "%s%u:%02u%s", pre, FRACTION(duration.seconds, 60), post);
put_format(b, "%s%u:%02u%s", pre, FRACTION_TUPLE(duration.seconds, 60), post);
}
void put_pressure(struct membuffer *b, pressure_t pressure, const char *pre, const char *post)
@ -243,7 +243,7 @@ void put_degrees(struct membuffer *b, degrees_t value, const char *pre, const ch
udeg = -udeg;
sign = "-";
}
put_format(b, "%s%s%u.%06u%s", pre, sign, FRACTION(udeg, 1000000), post);
put_format(b, "%s%s%u.%06u%s", pre, sign, FRACTION_TUPLE(udeg, 1000000), post);
}
void put_location(struct membuffer *b, const location_t *loc, const char *pre, const char *post)

View file

@ -59,7 +59,7 @@ extern "C" void dump_plan(struct diveplan *diveplan)
diveplan->surface_pressure);
dp = diveplan->dp;
while (dp) {
printf("\t%3u:%02u: %6dmm cylid: %2d setpoint: %d\n", FRACTION(dp->time, 60), dp->depth, dp->cylinderid, dp->setpoint);
printf("\t%3u:%02u: %6dmm cylid: %2d setpoint: %d\n", FRACTION_TUPLE(dp->time, 60), dp->depth, dp->cylinderid, dp->setpoint);
dp = dp->next;
}
}

View file

@ -156,7 +156,7 @@ extern "C" void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive,
translate("gettextFromC", "Subsurface"),
subsurface_canonical_version(),
translate("gettextFromC", "dive plan</b> (surface interval "),
FRACTION(diveplan->surface_interval / 60, 60),
FRACTION_TUPLE(diveplan->surface_interval / 60, 60),
translate("gettextFromC", "created on"),
get_current_date().c_str());
}
@ -234,16 +234,16 @@ extern "C" void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive,
buf += casprintf_loc(translate("gettextFromC", "%s to %.*f %s in %d:%02d min - runtime %d:%02u on %s (SP = %.1fbar)"),
dp->depth.mm < lastprintdepth ? translate("gettextFromC", "Ascend") : translate("gettextFromC", "Descend"),
decimals, depthvalue, depth_unit,
FRACTION(dp->time - lasttime, 60),
FRACTION(dp->time, 60),
FRACTION_TUPLE(dp->time - lasttime, 60),
FRACTION_TUPLE(dp->time, 60),
gasname(gasmix),
(double) dp->setpoint / 1000.0);
} else {
buf += casprintf_loc(translate("gettextFromC", "%s to %.*f %s in %d:%02d min - runtime %d:%02u on %s"),
dp->depth.mm < lastprintdepth ? translate("gettextFromC", "Ascend") : translate("gettextFromC", "Descend"),
decimals, depthvalue, depth_unit,
FRACTION(dp->time - lasttime, 60),
FRACTION(dp->time, 60),
FRACTION_TUPLE(dp->time - lasttime, 60),
FRACTION_TUPLE(dp->time, 60),
gasname(gasmix));
}
@ -256,15 +256,15 @@ extern "C" void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive,
if (dp->setpoint) {
buf += casprintf_loc(translate("gettextFromC", "Stay at %.*f %s for %d:%02d min - runtime %d:%02u on %s (SP = %.1fbar CCR)"),
decimals, depthvalue, depth_unit,
FRACTION(dp->time - lasttime, 60),
FRACTION(dp->time, 60),
FRACTION_TUPLE(dp->time - lasttime, 60),
FRACTION_TUPLE(dp->time, 60),
gasname(gasmix),
(double) dp->setpoint / 1000.0);
} else {
buf += casprintf_loc(translate("gettextFromC", "Stay at %.*f %s for %d:%02d min - runtime %d:%02u on %s %s"),
decimals, depthvalue, depth_unit,
FRACTION(dp->time - lasttime, 60),
FRACTION(dp->time, 60),
FRACTION_TUPLE(dp->time - lasttime, 60),
FRACTION_TUPLE(dp->time, 60),
gasname(gasmix),
translate("gettextFromC", divemode_text_ui[dp->divemode]));
}
@ -594,7 +594,7 @@ extern "C" void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive,
buf += "<div>\n";
o2warning_exist = true;
temp = casprintf_loc(translate("gettextFromC", "high pO₂ value %.2f at %d:%02u with gas %s at depth %.*f %s"),
pressures.o2, FRACTION(dp->time, 60), gasname(gasmix), decimals, depth_value, depth_unit);
pressures.o2, FRACTION_TUPLE(dp->time, 60), gasname(gasmix), decimals, depth_value, depth_unit);
buf += format_string_std("<span style='color: red;'>%s </span> %s<br/>\n", translate("gettextFromC", "Warning:"), temp.c_str());
} else if (pressures.o2 < 0.16) {
const char *depth_unit;
@ -604,7 +604,7 @@ extern "C" void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive,
buf += "<div>";
o2warning_exist = true;
temp = casprintf_loc(translate("gettextFromC", "low pO₂ value %.2f at %d:%02u with gas %s at depth %.*f %s"),
pressures.o2, FRACTION(dp->time, 60), gasname(gasmix), decimals, depth_value, depth_unit);
pressures.o2, FRACTION_TUPLE(dp->time, 60), gasname(gasmix), decimals, depth_value, depth_unit);
buf += format_string_std("<span style='color: red;'>%s </span> %s<br/>\n", translate("gettextFromC", "Warning:"), temp.c_str());
}
}

View file

@ -1368,7 +1368,7 @@ static std::vector<std::string> plot_string(const struct dive *d, const struct p
std::vector<std::string> res;
depthvalue = get_depth_units(entry->depth, NULL, &depth_unit);
res.push_back(casprintf_loc(translate("gettextFromC", "@: %d:%02d"), FRACTION(entry->sec, 60)));
res.push_back(casprintf_loc(translate("gettextFromC", "@: %d:%02d"), FRACTION_TUPLE(entry->sec, 60)));
res.push_back(casprintf_loc(translate("gettextFromC", "D: %.1f%s"), depthvalue, depth_unit));
for (cyl = 0; cyl < pi->nr_cylinders; cyl++) {
int mbar = get_plot_pressure(pi, idx, cyl);

View file

@ -135,9 +135,9 @@ static void put_gasmix(struct membuffer *b, struct gasmix mix)
int he = mix.he.permille;
if (o2) {
put_format(b, " o2=%u.%u%%", FRACTION(o2, 10));
put_format(b, " o2=%u.%u%%", FRACTION_TUPLE(o2, 10));
if (he)
put_format(b, " he=%u.%u%%", FRACTION(he, 10));
put_format(b, " he=%u.%u%%", FRACTION_TUPLE(he, 10));
}
}
@ -251,7 +251,7 @@ static void save_sample(struct membuffer *b, struct sample *sample, struct sampl
{
int idx;
put_format(b, "%3u:%02u", FRACTION(sample->time.seconds, 60));
put_format(b, "%3u:%02u", FRACTION_TUPLE(sample->time.seconds, 60));
put_milli(b, " ", sample->depth.mm, "m");
put_temperature(b, sample->temperature, " ", "°C");
@ -293,11 +293,11 @@ static void save_sample(struct membuffer *b, struct sample *sample, struct sampl
/* the deco/ndl values are stored whenever they change */
if (sample->ndl.seconds != old->ndl.seconds) {
put_format(b, " ndl=%u:%02u", FRACTION(sample->ndl.seconds, 60));
put_format(b, " ndl=%u:%02u", FRACTION_TUPLE(sample->ndl.seconds, 60));
old->ndl = sample->ndl;
}
if (sample->tts.seconds != old->tts.seconds) {
put_format(b, " tts=%u:%02u", FRACTION(sample->tts.seconds, 60));
put_format(b, " tts=%u:%02u", FRACTION_TUPLE(sample->tts.seconds, 60));
old->tts = sample->tts;
}
if (sample->in_deco != old->in_deco) {
@ -305,7 +305,7 @@ static void save_sample(struct membuffer *b, struct sample *sample, struct sampl
old->in_deco = sample->in_deco;
}
if (sample->stoptime.seconds != old->stoptime.seconds) {
put_format(b, " stoptime=%u:%02u", FRACTION(sample->stoptime.seconds, 60));
put_format(b, " stoptime=%u:%02u", FRACTION_TUPLE(sample->stoptime.seconds, 60));
old->stoptime = sample->stoptime;
}
@ -320,7 +320,7 @@ static void save_sample(struct membuffer *b, struct sample *sample, struct sampl
}
if (sample->rbt.seconds != old->rbt.seconds) {
put_format(b, " rbt=%u:%02u", FRACTION(sample->rbt.seconds, 60));
put_format(b, " rbt=%u:%02u", FRACTION_TUPLE(sample->rbt.seconds, 60));
old->rbt.seconds = sample->rbt.seconds;
}
@ -393,7 +393,7 @@ static void save_samples(struct membuffer *b, struct dive *dive, struct divecomp
static void save_one_event(struct membuffer *b, struct dive *dive, struct event *ev)
{
put_format(b, "event %d:%02d", FRACTION(ev->time.seconds, 60));
put_format(b, "event %d:%02d", FRACTION_TUPLE(ev->time.seconds, 60));
show_index(b, ev->type, "type=", "");
show_index(b, ev->flags, "flags=", "");
@ -456,7 +456,7 @@ static void create_dive_buffer(struct dive *dive, struct membuffer *b)
{
pressure_t surface_pressure = un_fixup_surface_pressure(dive);
if (dive->dc.duration.seconds > 0)
put_format(b, "duration %u:%02u min\n", FRACTION(dive->dc.duration.seconds, 60));
put_format(b, "duration %u:%02u min\n", FRACTION_TUPLE(dive->dc.duration.seconds, 60));
SAVE("rating", rating);
SAVE("visibility", visibility);
SAVE("wavesize", wavesize);
@ -653,7 +653,7 @@ static int save_one_picture(git_repository *repo, struct dir *dir, struct pictur
h = offset / 3600;
offset -= h *3600;
return blob_insert(repo, dir, &buf, "%c%02u=%02u=%02u",
sign, h, FRACTION(offset, 60));
sign, h, FRACTION_TUPLE(offset, 60));
}
static int save_pictures(git_repository *repo, struct dir *dir, struct dive *dive)

View file

@ -163,8 +163,8 @@ static void put_cylinder_HTML(struct membuffer *b, struct dive *dive)
}
if (cylinder->gasmix.o2.permille) {
put_format(b, "\"O2\":\"%u.%u%%\",", FRACTION(cylinder->gasmix.o2.permille, 10));
put_format(b, "\"He\":\"%u.%u%%\"", FRACTION(cylinder->gasmix.he.permille, 10));
put_format(b, "\"O2\":\"%u.%u%%\",", FRACTION_TUPLE(cylinder->gasmix.o2.permille, 10));
put_format(b, "\"He\":\"%u.%u%%\"", FRACTION_TUPLE(cylinder->gasmix.he.permille, 10));
} else {
write_attribute(b, "O2", "Air", "");
}
@ -364,7 +364,7 @@ static void write_one_dive(struct membuffer *b, struct dive *dive, const char *p
put_format(b, "\"surge\":%d,", dive->surge);
put_format(b, "\"chill\":%d,", dive->chill);
put_format(b, "\"dive_duration\":\"%u:%02u min\",",
FRACTION(dive->duration.seconds, 60));
FRACTION_TUPLE(dive->duration.seconds, 60));
put_string(b, "\"temperature\":{");
put_HTML_airtemp(b, dive, "\"air\":\"", "\",");
put_HTML_watertemp(b, dive, "\"water\":\"", "\"");

View file

@ -179,7 +179,7 @@ static void put_st_event(struct membuffer *b, struct plot_data *entry, int offse
put_video_time(b, entry->sec - offset);
put_video_time(b, (entry+1)->sec - offset < length ? (entry+1)->sec - offset : length);
put_format(b, "Default,,0,0,0,,");
put_format(b, "%d:%02d ", FRACTION(entry->sec, 60));
put_format(b, "%d:%02d ", FRACTION_TUPLE(entry->sec, 60));
value = get_depth_units(entry->depth, &decimals, &unit);
put_format(b, "D=%02.2f %s ", value, unit);
if (entry->temperature) {
@ -189,10 +189,10 @@ static void put_st_event(struct membuffer *b, struct plot_data *entry, int offse
// Only show NDL if it is not essentially infinite, show TTS for mandatory stops.
if (entry->ndl_calc < 3600) {
if (entry->ndl_calc > 0)
put_format(b, "NDL=%d:%02d ", FRACTION(entry->ndl_calc, 60));
put_format(b, "NDL=%d:%02d ", FRACTION_TUPLE(entry->ndl_calc, 60));
else
if (entry->tts_calc > 0)
put_format(b, "TTS=%d:%02d ", FRACTION(entry->tts_calc, 60));
put_format(b, "TTS=%d:%02d ", FRACTION_TUPLE(entry->tts_calc, 60));
}
if (entry->surface_gf > 0.0) {
put_format(b, "sGF=%.1f%% ", entry->surface_gf);

View file

@ -169,9 +169,9 @@ static void put_gasmix(struct membuffer *b, struct gasmix mix)
int he = mix.he.permille;
if (o2) {
put_format(b, " o2='%u.%u%%'", FRACTION(o2, 10));
put_format(b, " o2='%u.%u%%'", FRACTION_TUPLE(o2, 10));
if (he)
put_format(b, " he='%u.%u%%'", FRACTION(he, 10));
put_format(b, " he='%u.%u%%'", FRACTION_TUPLE(he, 10));
}
}
@ -236,7 +236,7 @@ static void save_sample(struct membuffer *b, struct sample *sample, struct sampl
{
int idx;
put_format(b, " <sample time='%u:%02u min'", FRACTION(sample->time.seconds, 60));
put_format(b, " <sample time='%u:%02u min'", FRACTION_TUPLE(sample->time.seconds, 60));
put_milli(b, " depth='", sample->depth.mm, " m'");
if (sample->temperature.mkelvin && sample->temperature.mkelvin != old->temperature.mkelvin) {
put_temperature(b, sample->temperature, " temp='", " C'");
@ -278,15 +278,15 @@ static void save_sample(struct membuffer *b, struct sample *sample, struct sampl
/* the deco/ndl values are stored whenever they change */
if (sample->ndl.seconds != old->ndl.seconds) {
put_format(b, " ndl='%u:%02u min'", FRACTION(sample->ndl.seconds, 60));
put_format(b, " ndl='%u:%02u min'", FRACTION_TUPLE(sample->ndl.seconds, 60));
old->ndl = sample->ndl;
}
if (sample->tts.seconds != old->tts.seconds) {
put_format(b, " tts='%u:%02u min'", FRACTION(sample->tts.seconds, 60));
put_format(b, " tts='%u:%02u min'", FRACTION_TUPLE(sample->tts.seconds, 60));
old->tts = sample->tts;
}
if (sample->rbt.seconds != old->rbt.seconds) {
put_format(b, " rbt='%u:%02u min'", FRACTION(sample->rbt.seconds, 60));
put_format(b, " rbt='%u:%02u min'", FRACTION_TUPLE(sample->rbt.seconds, 60));
old->rbt = sample->rbt;
}
if (sample->in_deco != old->in_deco) {
@ -294,7 +294,7 @@ static void save_sample(struct membuffer *b, struct sample *sample, struct sampl
old->in_deco = sample->in_deco;
}
if (sample->stoptime.seconds != old->stoptime.seconds) {
put_format(b, " stoptime='%u:%02u min'", FRACTION(sample->stoptime.seconds, 60));
put_format(b, " stoptime='%u:%02u min'", FRACTION_TUPLE(sample->stoptime.seconds, 60));
old->stoptime = sample->stoptime;
}
@ -355,7 +355,7 @@ static void save_sample(struct membuffer *b, struct sample *sample, struct sampl
static void save_one_event(struct membuffer *b, struct dive *dive, struct event *ev)
{
put_format(b, " <event time='%d:%02d min'", FRACTION(ev->time.seconds, 60));
put_format(b, " <event time='%d:%02d min'", FRACTION_TUPLE(ev->time.seconds, 60));
show_index(b, ev->type, "type='", "'");
show_index(b, ev->flags, "flags='", "'");
if (!strcmp(ev->name,"modechange"))
@ -490,7 +490,7 @@ static void save_picture(struct membuffer *b, struct picture *pic)
sign = '-';
offset = -offset;
}
put_format(b, " offset='%c%u:%02u min'", sign, FRACTION(offset, 60));
put_format(b, " offset='%c%u:%02u min'", sign, FRACTION_TUPLE(offset, 60));
}
put_location(b, &pic->location, " gps='","'");
@ -525,7 +525,7 @@ extern "C" void save_one_dive_to_mb(struct membuffer *b, struct dive *dive, bool
// These three are calculated, and not read when loading.
// But saving them into the XML is useful for data export.
if (dive->sac > 100)
put_format(b, " sac='%d.%03d l/min'", FRACTION(dive->sac, 1000));
put_format(b, " sac='%d.%03d l/min'", FRACTION_TUPLE(dive->sac, 1000));
if (dive->otu)
put_format(b, " otu='%d'", dive->otu);
if (dive->maxcns)
@ -541,7 +541,7 @@ extern "C" void save_one_dive_to_mb(struct membuffer *b, struct dive *dive, bool
put_pressure(b, surface_pressure, " airpressure='", " bar'");
if (dive->dc.duration.seconds > 0)
put_format(b, " duration='%u:%02u min'>\n",
FRACTION(dive->dc.duration.seconds, 60));
FRACTION_TUPLE(dive->dc.duration.seconds, 60));
else
put_format(b, ">\n");
save_overview(b, dive, anonymize);

View file

@ -302,7 +302,7 @@ QString formatDayOfWeek(int day)
QString formatMinutes(int seconds)
{
return QString::asprintf("%d:%.2d", FRACTION(seconds, 60));
return QString::asprintf("%d:%.2d", FRACTION_TUPLE(seconds, 60));
}
QString formatTripTitle(const dive_trip *trip)

View file

@ -380,11 +380,11 @@ void uemis_parse_divelog_binary(char *base64, void *datap)
add_extra_data(dc, "Serial", buffer);
snprintf(buffer, sizeof(buffer), "%d", *(uint16_t *)(data + i + 35));
add_extra_data(dc, "main battery after dive", buffer);
snprintf(buffer, sizeof(buffer), "%0u:%02u", FRACTION(*(uint16_t *)(data + i + 24), 60));
snprintf(buffer, sizeof(buffer), "%0u:%02u", FRACTION_TUPLE(*(uint16_t *)(data + i + 24), 60));
add_extra_data(dc, "no fly time", buffer);
snprintf(buffer, sizeof(buffer), "%0u:%02u", FRACTION(*(uint16_t *)(data + i + 26), 60));
snprintf(buffer, sizeof(buffer), "%0u:%02u", FRACTION_TUPLE(*(uint16_t *)(data + i + 26), 60));
add_extra_data(dc, "no dive time", buffer);
snprintf(buffer, sizeof(buffer), "%0u:%02u", FRACTION(*(uint16_t *)(data + i + 28), 60));
snprintf(buffer, sizeof(buffer), "%0u:%02u", FRACTION_TUPLE(*(uint16_t *)(data + i + 28), 60));
add_extra_data(dc, "desat time", buffer);
snprintf(buffer, sizeof(buffer), "%u", *(uint16_t *)(data + i + 30));
add_extra_data(dc, "allowed altitude", buffer);

View file

@ -13,8 +13,8 @@ extern "C" {
#include <stdbool.h>
#endif
#define FRACTION(n, x) ((unsigned)(n) / (x)), ((unsigned)(n) % (x))
#define SIGNED_FRAC(n, x) ((n) >= 0 ? '+': '-'), ((n) >= 0 ? (unsigned)(n) / (x) : (-(n) / (x))), ((unsigned)((n) >= 0 ? (n) : -(n)) % (x))
#define FRACTION_TUPLE(n, x) ((unsigned)(n) / (x)), ((unsigned)(n) % (x))
#define SIGNED_FRAC_TRIPLET(n, x) ((n) >= 0 ? '+': '-'), ((n) >= 0 ? (unsigned)(n) / (x) : (-(n) / (x))), ((unsigned)((n) >= 0 ? (n) : -(n)) % (x))
#define O2_IN_AIR 209 // permille
#define N2_IN_AIR 781

View file

@ -1177,7 +1177,7 @@ int DivePlannerPointsModel::analyzeVariations(struct decostop *min, struct decos
rightsum = maxsum - midsum;
#ifdef DEBUG_STOPVAR
printf("Total + %d:%02d/%s +- %d s/%s\n\n", FRACTION((leftsum + rightsum) / 2, 60), unit,
printf("Total + %d:%02d/%s +- %d s/%s\n\n", FRACTION_TUPLE((leftsum + rightsum) / 2, 60), unit,
(rightsum - leftsum) / 2, unit);
#else
Q_UNUSED(unit)
@ -1266,8 +1266,8 @@ void DivePlannerPointsModel::computeVariations(struct diveplan *original_plan, c
char buf[200];
sprintf(buf, ", %s: %c %d:%02d /%s %c %d:%02d /min", qPrintable(tr("Stop times")),
SIGNED_FRAC(analyzeVariations(shallower, original, deeper, qPrintable(depth_units)), 60), qPrintable(depth_units),
SIGNED_FRAC(analyzeVariations(shorter, original, longer, qPrintable(time_units)), 60));
SIGNED_FRAC_TRIPLET(analyzeVariations(shallower, original, deeper, qPrintable(depth_units)), 60), qPrintable(depth_units),
SIGNED_FRAC_TRIPLET(analyzeVariations(shorter, original, longer, qPrintable(time_units)), 60));
// By using a signal, we can transport the variations to the main thread.
emit variationsComputed(QString(buf));