summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4834a34)
raw | patch | inline | side by side (parent: 4834a34)
author | Florian Forster <ff@octo.it> | |
Sun, 12 Oct 2014 15:32:47 +0000 (17:32 +0200) | ||
committer | Florian Forster <ff@octo.it> | |
Sun, 12 Oct 2014 15:32:47 +0000 (17:32 +0200) |
src/oping.c | patch | blob | history |
diff --git a/src/oping.c b/src/oping.c
index 5e63392092acbaa7b3dea0d76be3161c5e846cbd..1590bfe54773c2ec8ec5d60ee85467a38ebe9ec3 100644 (file)
--- a/src/oping.c
+++ b/src/oping.c
# define OPING_YELLOW_HIST 5
# define OPING_RED_HIST 6
+double const threshold_green = 0.8;
+double const threshold_yellow = 0.95;
+
static char const * const hist_symbols_utf8[] = {
"▁", "▂", "▃", "▄", "▅", "▆", "▇", "█" };
static size_t const hist_symbols_utf8_num = sizeof (hist_symbols_utf8)
if (has_colors () == TRUE)
{
- if ((ratio_this <= 0.5) || ((ratio_prev < 0.5) && (ratio_this > 0.5)))
+ if ((ratio_this <= threshold_green)
+ || ((ratio_prev < threshold_green)
+ && (ratio_this > threshold_green)))
color = OPING_GREEN;
- else if ((ratio_this <= 0.95) || ((ratio_prev < 0.95) && (ratio_this > 0.95)))
+ else if ((ratio_this <= threshold_yellow)
+ || ((ratio_prev < threshold_yellow)
+ && (ratio_this > threshold_yellow)))
color = OPING_YELLOW;
else
color = OPING_RED;
else
ratio_prev = 0.0;
- if ((ratio_this <= 0.5) ||
- ((ratio_prev < 0.5) && (ratio_this > 0.5)))
+ if ((ratio_this <= threshold_green)
+ || ((ratio_prev < threshold_green)
+ && (ratio_this > threshold_green)))
color = OPING_GREEN;
- else if ((ratio_this <= 0.95) ||
- ((ratio_prev < 0.95) && (ratio_this > 0.95)))
+ else if ((ratio_this <= threshold_yellow)
+ || ((ratio_prev < threshold_yellow)
+ && (ratio_this > threshold_yellow)))
color = OPING_YELLOW;
else
color = OPING_RED;