PebbleOS
Loading...
Searching...
No Matches
Macros | Functions
health_util.h File Reference
#include <apps/system/timeline/text_node.h>
#include <stddef.h>
#include <stdint.h>
#include <time.h>

Macros

#define MAX_TEXT_NODES   5
 Maximum number of text nodes needed in a text node container.
 
#define HEALTH_WHOLE_AND_DECIMAL_LENGTH   (sizeof("00.0") + 4)
 Buffer size for a "00.0" formatted value, with 4 extra bytes for translations.
 

Functions

int health_util_format_hours_and_minutes (char *buffer, size_t buffer_size, int duration_s, void *i18n_owner)
 Format a duration as hours and minutes, e.g.
 
GTextNodeText * health_util_create_text_node (int buffer_size, GFont font, GColor color, GTextNodeContainer *container)
 Create a text node with its own buffer and add it to a container.
 
GTextNodeText * health_util_create_text_node_with_text (const char *text, GFont font, GColor color, GTextNodeContainer *container)
 Create a text node showing a string and add it to a container.
 
int health_util_format_hours_minutes_seconds (char *buffer, size_t buffer_size, int duration_s, bool leading_zero, void *i18n_owner)
 Format a duration as hours, minutes and seconds, e.g.
 
int health_util_format_minutes_and_seconds (char *buffer, size_t buffer_size, int duration_s, void *i18n_owner)
 Format a duration as minutes and seconds, e.g.
 
void health_util_duration_to_hours_and_minutes_text_node (int duration_s, void *i18n_owner, GFont number_font, GFont units_font, GColor color, GTextNodeContainer *container)
 Add text nodes showing a duration as hours and minutes, e.g.
 
void health_util_convert_fraction_to_whole_and_decimal_part (int numerator, int denominator, int *whole_part, int *decimal_part)
 Split a fraction into whole and tenths parts, rounded to the nearest tenth.
 
int health_util_format_whole_and_decimal (char *buffer, size_t buffer_size, int numerator, int denominator)
 Format a fraction with one decimal, e.g.
 
int health_util_get_distance_factor (void)
 Get the number of meters in the user's distance unit.
 
time_t health_util_get_pace (int time_s, int distance_meter)
 Compute a pace in the user's distance unit.
 
const char * health_util_get_distance_string (const char *miles_string, const char *km_string)
 Pick the units string matching the user's distance unit.
 
int health_util_format_distance (char *buffer, size_t buffer_size, uint32_t distance_m)
 Format a distance in the user's distance unit with one decimal, e.g.
 
void health_util_convert_distance_to_whole_and_decimal_part (int distance_m, int *whole_part, int *decimal_part)
 Convert a distance to the user's distance unit, as whole and tenths parts.