mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-13 10:58:36 -07:00
Move plugins to external folder
This commit is contained in:
16
applications/external/totp/lib/timezone_utils/timezone_utils.c
vendored
Normal file
16
applications/external/totp/lib/timezone_utils/timezone_utils.c
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
#include "timezone_utils.h"
|
||||
|
||||
int32_t timezone_offset_from_hours(float hours) {
|
||||
return hours * 3600.0f;
|
||||
}
|
||||
|
||||
uint64_t timezone_offset_apply(uint64_t time, int32_t offset) {
|
||||
uint64_t for_time_adjusted;
|
||||
if(offset > 0) {
|
||||
for_time_adjusted = time - offset;
|
||||
} else {
|
||||
for_time_adjusted = time + (-offset);
|
||||
}
|
||||
|
||||
return for_time_adjusted;
|
||||
}
|
||||
18
applications/external/totp/lib/timezone_utils/timezone_utils.h
vendored
Normal file
18
applications/external/totp/lib/timezone_utils/timezone_utils.h
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
/**
|
||||
* @brief Calculates timezone offset in seconds given timezone offset in hours.
|
||||
* @param hours timezone offset in hours
|
||||
* @return Timezone offset in seconds.
|
||||
*/
|
||||
int32_t timezone_offset_from_hours(float hours);
|
||||
|
||||
/**
|
||||
* @brief Applies timezone offset to a given time.
|
||||
* @param time time to apply offset to.
|
||||
* @param offset timezone offset in seconds.
|
||||
* @return Time with timezone offset applied.
|
||||
*/
|
||||
uint64_t timezone_offset_apply(uint64_t time, int32_t offset);
|
||||
Reference in New Issue
Block a user