File: convert.h

package info (click to toggle)
wmweather+ 2.15-1.1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,100 kB
  • ctags: 579
  • sloc: ansic: 5,822; sh: 1,294; makefile: 42
file content (67 lines) | stat: -rw-r--r-- 1,796 bytes parent folder | download | duplicates (6)
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#ifndef PI
# define PI 3.1415926535897932384626433832795029L
#endif

/*
 * Note that all floating point calculations are rounded with .5 going up.
 * Since C automatically truncates, adding .5 to every calculation does
 * rounding for us nicely.
 *
 * To indicate unavailable data
 *   999 is used for temperature
 *   x<0 is used for rh, pressure, and windspeed
 */

/* Calculations */
int rh_C(int temp_C, int dewpt_C);
int rh_F(int temp_F, int dewpt_F);
int heatindex_C(int temp_C, int rh);
int heatindex_F(int temp_F, int rh);
int windchill_C(int temp_C, int windspeed); /* knots */
int windchill_F(int temp_F, int windspeed); /* knots */

/* Length Conversions */
int in2cm(int in);
float m2mi(int meters);

/* Windspeed Conversions */
int knots2mph(int knots);
int knots2kph(int knots);
int knots2mps(int knots);
int knots2beaufort(int knots);
int kph2knots(int kph);
int mps2knots(int mps);

/* Temperature Conversions */
int temp_C2F(int temp_C);
int temp_F2C(int temp_F);

/* Pressure Conversions */
float inHg2mmHg(float inHg);
float inHg2hPa(float inHg);
float inHg2atm(float inHg);
float hPa2inHg(float hPa);

/* Time Conversions */
time_t mkgmtime(struct tm *tm);
int utc2local(int hm, int *mon, int *day, int *year, int *wday);
int local2utc(int hm, int *mon, int *day, int *year, int *wday);
void fix_date(int *month, int *day, int *year, int *wday);
int hm2min(int hm);

/* Letter Case (destructive!) */
char *str_upper(char *str);
char *str_lower(char *str);

/* Angle conversions */
double rad2deg(double angle);
double deg2rad(double angle);

/* Date conversions */
int mdy2doy(int mn, int dy, int y);
double mdy2jd(int year, int month, int day);
double jd2jcent(double jd);
double jcent2jd(double t);

/* Lat/Long conversions */
int str2dd(char *s, double *lat, double *lon);