-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvactija.h
49 lines (32 loc) · 1.16 KB
/
vactija.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
40
41
42
43
44
45
46
47
48
49
#ifndef VACTIJA_H
#define VACTIJA_H
#include <time.h>
#define VAKTIJA_API_URL "https://api.vaktija.ba/vaktija/v1/"
/*
Number of tokens (JSON elements) in vaktija JSON file.
Essentially determined experimentally.
In case the program downloads a vaktija for a particular date
it will have 23 tokens, but otherwise it should only have 17.
*/
#define VACTIJA_JSMN_TOKENS 23
/*
Array sizes as they appear in the vaktija JSON file.
*/
#define PRAYER_TIME_NUM 6
#define DATUM_NUM 2
struct vaktija {
char **prayers;
char *location;
char **dates;
};
char *download_vaktija(const char *loc, const char *date);
struct vaktija *parse_data(const char *json);
int next_vakat(const struct vaktija *vaktija, struct tm time);
int current_vakat(const struct vaktija *vaktija, struct tm time);
void calculate_midnight(const struct vaktija *vaktija, struct tm *midnight);
void calculate_third(const struct vaktija *vaktija, struct tm *third);
void print_vakat(const struct vaktija *vaktija, int vakat, int raw);
void print_vaktija(const struct vaktija *vaktija);
struct vaktija *create_vaktija(void);
void delete_vaktija(struct vaktija *vaktija);
#endif