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

Pure wind-speed conversions and unit labels, no SDK behind them. More...

#include "units/wind.h"

Functions

static int scale_rounded (int kmh, int per_thousand)
 Scales a speed by a factor in thousandths and rounds to the nearest whole number.
int wind_from_kmh (int kmh, WindUnit unit)
 Convert a km/h wind speed into the chosen unit.
const char * wind_unit_label (WindUnit unit)
 The short label for a wind unit.

Detailed Description

Pure wind-speed conversions and unit labels, no SDK behind them.

Function Documentation

◆ scale_rounded()

int scale_rounded ( int kmh,
int per_thousand )
static

Scales a speed by a factor in thousandths and rounds to the nearest whole number.

A half rounds away from zero, so a negative speed rounds the same way as its positive.

Parameters
kmhThe speed in km/h.
per_thousandHow many thousandths of the unit one km/h is.
Returns
The speed in the unit, rounded.