aboutsummaryrefslogtreecommitdiff
path: root/util.c
blob: d78809f9fa56cff8622c10c855f6ff563a6353ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <math.h>
#include <string.h>

#include "util.h"

float pressure_to_metres_asl(float real, float setting)
{
	return 44330.f*(1.f-powf(real/setting, 1/5.255));
}

void blank_to_eol(char *line, size_t len)
{
	size_t i = 0;
	for (i = strnlen(line, len - 1); i < len - 1; i++) {
		line[i] = ' ';
	}
	line[i] = '\0';
}