Infuse-IoT SDK API 0.0.1
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
timezone.h
Go to the documentation of this file.
1
9
10#ifndef INFUSE_SDK_INCLUDE_INFUSE_TIME_TIMEZONE_H_
11#define INFUSE_SDK_INCLUDE_INFUSE_TIME_TIMEZONE_H_
12
13#include <stdint.h>
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
24
37static inline int8_t utc_timezone_location_approximate(int32_t longitude)
38{
39 int32_t rounding = longitude > 0 ? 75000000 : -75000000;
40
41 return (longitude + rounding) / 150000000;
42}
43
56static inline int16_t utc_timezone_minutes_location_approximate(int32_t longitude)
57{
58 int32_t rounding = longitude > 0 ? 1250000 : -1250000;
59
60 return (longitude + rounding) / 2500000;
61}
62
66
67#ifdef __cplusplus
68}
69#endif
70
71#endif /* INFUSE_SDK_INCLUDE_INFUSE_TIME_TIMEZONE_H_ */
static int8_t utc_timezone_location_approximate(int32_t longitude)
Calculate the approximate UTC timezone of a location.
Definition timezone.h:37
static int16_t utc_timezone_minutes_location_approximate(int32_t longitude)
Calculate the approximate UTC timezone of a location in minutes.
Definition timezone.h:56