SuperNOVAS C API v1.8
High-precision C/C++ astrometry library
Loading...
Searching...
No Matches
calendar.c File Reference

Various functions to convert between calendar dates and Julian days. More...

Functions

int cal_date (double tjd, short *restrict year, short *restrict month, short *restrict day, double *restrict hour)
 This function will compute a broken down date on the astronomical calendar given the Julian day input.
double julian_date (short year, short month, short day, double hour)
 Returns the Julian day for a given astronomical calendar date.
int novas_day_of_week (double tjd)
 Returns the one-based ISO 8601 day-of-week index of a given Julian Date.
int novas_day_of_year (double tjd, enum novas_calendar_type calendar, int *restrict year)
 Returns the one-based day index in the calendar year for a given Julian Date.
int novas_is_leap_year (int year, enum novas_calendar_type calendar)
 Checks if a given year is a leap year in a specific calendar.
double novas_jd_from_date (enum novas_calendar_type calendar, int year, int month, int day, double hour)
 Returns the Julian day for a given calendar date.
int novas_jd_to_date (double tjd, enum novas_calendar_type calendar, int *restrict year, int *restrict month, int *restrict day, double *restrict hour)
 This function will compute a broken down date on the specified calendar for given the Julian day input.

Detailed Description

Various functions to convert between calendar dates and Julian days.

Date
Created on Mar 6, 2025
Author
Attila Kovacs and G. Kaplan
See also
timescale.c

Function Documentation

◆ novas_is_leap_year()

int novas_is_leap_year ( int year,
enum novas_calendar_type calendar )

Checks if a given year is a leap year in a specific calendar.

Parameters
year[yr] The calendar year. for X BCE, it is 1 - X. For example 45 BCE is -44.
calendarThe type of calendar
Returns
TRUE (1) if the year is a leap year in the calendar, or FALSE (0) if it is not a leap year, or else -1 if the calendar is invalid (errno set to EINVAL).
Since
1.8
See also
novas_day_of_year()

References NOVAS_ASTRONOMICAL_CALENDAR, NOVAS_GREGORIAN_CALENDAR, novas_is_leap_year(), and NOVAS_ROMAN_CALENDAR.

Referenced by novas_day_of_year(), and novas_is_leap_year().