php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
astro.c File Reference
#include "timelib.h"
#include <stdio.h>
#include <math.h>
#include "astro.h"

Go to the source code of this file.

Macros

#define days_since_2000_Jan_0(y, m, d)
 
#define PI   3.1415926535897932384
 
#define RADEG   ( 180.0 / PI )
 
#define DEGRAD   ( PI / 180.0 )
 
#define sind(x)
 
#define cosd(x)
 
#define tand(x)
 
#define atand(x)
 
#define asind(x)
 
#define acosd(x)
 
#define atan2d(y, x)
 
#define INV360   (1.0 / 360.0)
 

Functions

int timelib_astro_rise_set_altitude (timelib_time *t_loc, double lon, double lat, double altit, int upper_limb, double *h_rise, double *h_set, timelib_sll *ts_rise, timelib_sll *ts_set, timelib_sll *ts_transit)
 
double timelib_ts_to_julianday (timelib_sll ts)
 
double timelib_ts_to_j2000 (timelib_sll ts)
 

Macro Definition Documentation

◆ acosd

#define acosd ( x)
Value:
(RADEG*acos(x))
#define RADEG
Definition astro.c:40
acos(float $num)

Definition at line 51 of file astro.c.

◆ asind

#define asind ( x)
Value:
(RADEG*asin(x))
asin(float $num)

Definition at line 50 of file astro.c.

◆ atan2d

#define atan2d ( y,
x )
Value:
(RADEG*atan2(y,x))
atan2(float $y, float $x)

Definition at line 52 of file astro.c.

◆ atand

#define atand ( x)
Value:
(RADEG*atan(x))
atan(float $num)

Definition at line 49 of file astro.c.

◆ cosd

#define cosd ( x)
Value:
cos((x)*DEGRAD)
#define DEGRAD
Definition astro.c:41
cos(float $num)

Definition at line 46 of file astro.c.

◆ days_since_2000_Jan_0

#define days_since_2000_Jan_0 ( y,
m,
d )
Value:
(367L*(y)-((7*((y)+(((m)+9)/12)))/4)+((275*(m))/9)+(d)-730530L)

Definition at line 33 of file astro.c.

◆ DEGRAD

#define DEGRAD   ( PI / 180.0 )

Definition at line 41 of file astro.c.

◆ INV360

#define INV360   (1.0 / 360.0)

Definition at line 69 of file astro.c.

◆ PI

#define PI   3.1415926535897932384

Definition at line 37 of file astro.c.

◆ RADEG

#define RADEG   ( 180.0 / PI )

Definition at line 40 of file astro.c.

◆ sind

#define sind ( x)
Value:
sin((x)*DEGRAD)
sin(float $num)

Definition at line 45 of file astro.c.

◆ tand

#define tand ( x)
Value:
tan((x)*DEGRAD)
tan(float $num)

Definition at line 47 of file astro.c.

Function Documentation

◆ timelib_astro_rise_set_altitude()

int timelib_astro_rise_set_altitude ( timelib_time * t_loc,
double lon,
double lat,
double altit,
int upper_limb,
double * h_rise,
double * h_set,
timelib_sll * ts_rise,
timelib_sll * ts_set,
timelib_sll * ts_transit )

Note: timestamp = unixtimestamp (NEEDS to be 00:00:00 UT) Eastern longitude positive, Western longitude negative Northern latitude positive, Southern latitude negative The longitude value IS critical in this function! altit = the altitude which the Sun should cross Set to -35/60 degrees for rise/set, -6 degrees for civil, -12 degrees for nautical and -18 degrees for astronomical twilight. upper_limb: non-zero -> upper limb, zero -> center Set to non-zero (e.g. 1) when computing rise/set times, and to zero when computing start/end of twilight. *rise = where to store the rise time *set = where to store the set time Both times are relative to the specified altitude, and thus this function can be used to compute various twilight times, as well as rise/set times Return value: 0 = sun rises/sets this day, times stored at *trise and *tset. +1 = sun above the specified "horizon" 24 hours. *trise set to time when the sun is at south, minus 12 hours while *tset is set to the south time plus 12 hours. "Day" length = 24 hours -1 = sun is below the specified "horizon" 24 hours "Day" length = 0 hours, *trise and *tset are both set to the time when the sun is at south.

Definition at line 212 of file astro.c.

◆ timelib_ts_to_j2000()

double timelib_ts_to_j2000 ( timelib_sll ts)

Converts the Unix Epoch time stamp 'ts' to the J2000 epoch

The value returned is the number of whole days since 2000-01-01T12:00:00 UTC: https://en.wikipedia.org/wiki/Epoch_(astronomy)#Julian_years_and_J2000

Definition at line 310 of file astro.c.

◆ timelib_ts_to_julianday()

double timelib_ts_to_julianday ( timelib_sll ts)

Converts the Unix Epoch time stamp 'ts' to a Julian Day

The value returned is the number of whole days since -4714-11-24T12:00:00 UTC (in the proleptic Gregorian calendar): https://en.wikipedia.org/wiki/Julian_day

Definition at line 299 of file astro.c.