-
Notifications
You must be signed in to change notification settings - Fork 0
/
sun.h
39 lines (30 loc) · 762 Bytes
/
sun.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// sun: compute sunrise/sunset times
//
// https://github.com/oreparaz/sun
//
// (c) 2022 Oscar Reparaz <firstname.lastname@esat.kuleuven.be>
#ifndef SUN_H
#define SUN_H
#include <stddef.h>
#include <stdint.h>
typedef uint64_t fti_sample_t;
typedef struct sun_ctx_t {
double in_latitude;
double in_longitude;
uint32_t in_yday; // number of days since Jan 1, in the range of 0 to 365
uint32_t in_hour; // number of hours past midnight (range 0 to 23)
double out_sunrise_mins; // minutes after midnight (UTC)
double out_sunset_mins;
} sun_ctx_t;
typedef enum {
SUN_SUCCESS = 0,
SUN_ERROR,
} sun_ret_t;
#ifdef __cplusplus
extern "C" {
#endif
sun_ret_t sun_compute(sun_ctx_t *ctx);
#ifdef __cplusplus
}
#endif
#endif //SUN_H