mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-04-19 19:25:41 +02:00
module: battery: style
This commit is contained in:
parent
3a3a711b69
commit
9365580539
1 changed files with 3 additions and 2 deletions
|
@ -61,7 +61,8 @@ struct private {
|
||||||
long time_to_full;
|
long time_to_full;
|
||||||
};
|
};
|
||||||
|
|
||||||
int64_t difftimespec_ns(const struct timespec after, const struct timespec before)
|
static int64_t
|
||||||
|
difftimespec_ns(const struct timespec after, const struct timespec before)
|
||||||
{
|
{
|
||||||
return ((int64_t)after.tv_sec - (int64_t)before.tv_sec) * (int64_t)one_sec_in_ns
|
return ((int64_t)after.tv_sec - (int64_t)before.tv_sec) * (int64_t)one_sec_in_ns
|
||||||
+ ((int64_t)after.tv_nsec - (int64_t)before.tv_nsec);
|
+ ((int64_t)after.tv_nsec - (int64_t)before.tv_nsec);
|
||||||
|
@ -70,7 +71,7 @@ int64_t difftimespec_ns(const struct timespec after, const struct timespec befor
|
||||||
// Linear Exponential Moving Average (unevenly spaced time series)
|
// Linear Exponential Moving Average (unevenly spaced time series)
|
||||||
// http://www.eckner.com/papers/Algorithms%20for%20Unevenly%20Spaced%20Time%20Series.pdf
|
// http://www.eckner.com/papers/Algorithms%20for%20Unevenly%20Spaced%20Time%20Series.pdf
|
||||||
// Adapted from: https://github.com/andreas50/utsAlgorithms/blob/master/ema.c
|
// Adapted from: https://github.com/andreas50/utsAlgorithms/blob/master/ema.c
|
||||||
void
|
static void
|
||||||
ema_linear(struct current_state *state, struct current_state curr, long tau)
|
ema_linear(struct current_state *state, struct current_state curr, long tau)
|
||||||
{
|
{
|
||||||
double w, w2, tmp;
|
double w, w2, tmp;
|
||||||
|
|
Loading…
Add table
Reference in a new issue