Loading...
Searching...
No Matches
units.c File Reference

The SDK-facing units facade. Reads the clock for .beats and forwards the rest to the pure lib cores, clock/beats and units/distance. More...

#include "system/units/units.h"
#include "clock/beats.h"
#include "units/distance.h"

Functions

static int32_t ms_into_bmt_day (void)
 Milliseconds into the current Biel Mean Time day, read straight off the watch's clock.
int units_swatch_beats (void)
 The current swatch internet time, in .beats.
uint32_t units_ms_until_next_beat (void)
 Milliseconds until the next .beats boundary.
void units_format_distance (char *buffer, size_t size, int meters, bool miles)
 Formats a distance as "N.N MI" or "N.N KM".
void units_format_distance_value (char *buffer, size_t size, int meters, bool miles)
 Formats a distance as just "N.N", with no unit suffix, rounded to a tenth.
const char * units_distance_unit (bool miles)
 The unit label for the current distance mode, "MI" or "KM".

Detailed Description

The SDK-facing units facade. Reads the clock for .beats and forwards the rest to the pure lib cores, clock/beats and units/distance.

Function Documentation

◆ ms_into_bmt_day()

int32_t ms_into_bmt_day ( void )
static

Milliseconds into the current Biel Mean Time day, read straight off the watch's clock.

Reads the clock, breaks it apart, and hands the pieces to the maths. Reading and breaking apart are the parts that need the SDK. gmtime and struct tm are pebble.h's here rather than time.h's, so they stay on this side of the fence and the sum lives next door in core.

Returns
Milliseconds into the current BMT day.