calendar

calendar —

Synopsis




#define     FOUR_DIGIT_YEAR                 (y)
long        get_epoch_day                   (const char *date);
int         get_day_of_week                 (const char *date);
int         day_starts_month                (int d,
                                             int m,
                                             int y,
                                             int wkdays,
                                             int *pad);
int         day_ends_month                  (int d,
                                             int m,
                                             int y,
                                             int wkdays);
int         get_days_in_month               (int mon,
                                             int yr,
                                             int wkdays);
int         days_in_month_before            (int yr,
                                             int mon,
                                             int day,
                                             int wkdays);
int         days_in_month_after             (int yr,
                                             int mon,
                                             int day,
                                             int wkdays);
int         calendar_obs_number             (const char *date,
                                             const DATAINFO *pdinfo);
void        calendar_date_string            (char *str,
                                             int t,
                                             const DATAINFO *pdinfo);
int         MS_excel_date_string            (char *date,
                                             int mst,
                                             int pd,
                                             int d1904);
double      get_dec_date                    (const char *date);
int         n_hidden_missing_obs            (const DATAINFO *pdinfo);
int         guess_daily_pd                  (const DATAINFO *pdinfo);

Description

Details

FOUR_DIGIT_YEAR()

#define FOUR_DIGIT_YEAR(y) ((y < 50)? y + 2000 : y + 1900)

y :

get_epoch_day ()

long        get_epoch_day                   (const char *date);

date : string representation of calendar date, in form YY[YY]/MM/DD.
Returns : the epoch day number, or -1 on failure.

get_day_of_week ()

int         get_day_of_week                 (const char *date);

date : calendar representation of date, [YY]YY/MM/DD
Returns : day of week as integer, Sunday = 0.

day_starts_month ()

int         day_starts_month                (int d,
                                             int m,
                                             int y,
                                             int wkdays,
                                             int *pad);

d : day of month, 1-based
m : month number, 1-based
y : 4-digit year
wkdays : number of days in week (7, 6 or 5)
pad : content set = 1 if the first day of the month can reasonably be padded by a missing value (Jan 1)
Returns : 1 if the day is the "first day of the month", allowance made for the possibility of a 5- or 6-day week, else 0.

day_ends_month ()

int         day_ends_month                  (int d,
                                             int m,
                                             int y,
                                             int wkdays);

d : day of month, 1-based
m : month number, 1-based
y : 4-digit year
wkdays : number of days in week (7, 6 or 5)
Returns : 1 if the day is the "last day of the month", allowance made for the possibility of a 5- or 6-day week, else 0.

get_days_in_month ()

int         get_days_in_month               (int mon,
                                             int yr,
                                             int wkdays);

mon : month number, 1-based
yr : 4-digit year
wkdays : number of days in week (7, 6 or 5)
Returns : the number of days in the month, allowance made for the possibility of a 5- or 6-day week.

days_in_month_before ()

int         days_in_month_before            (int yr,
                                             int mon,
                                             int day,
                                             int wkdays);

yr :
mon :
day :
wkdays :
Returns :

days_in_month_after ()

int         days_in_month_after             (int yr,
                                             int mon,
                                             int day,
                                             int wkdays);

yr :
mon :
day :
wkdays :
Returns :

calendar_obs_number ()

int         calendar_obs_number             (const char *date,
                                             const DATAINFO *pdinfo);

date : string representation of calendar date, in form YY[YY]/MM/DD.
pdinfo : pointer to dataset information.
Returns : The zero-based observation number for the given date within the current data set.

calendar_date_string ()

void        calendar_date_string            (char *str,
                                             int t,
                                             const DATAINFO *pdinfo);

Writes to str the calendar representation of the date of observation t, in the form YY[YY]/MM/DD.

str : string to be filled out.
t : zero-based index of observation.
pdinfo : pointer to dataset information.

MS_excel_date_string ()

int         MS_excel_date_string            (char *date,
                                             int mst,
                                             int pd,
                                             int d1904);

Writes to date the calendar representation of the date of observation mst, in the form YYYY/MM/DD if pd is 0, 5, 6, 7 or 52 (unknown, daily, or weekly frequency), otherwise in the appropriate format for annual, quarterly or monthly data.

date : date string to be filled out.
mst : MS Excel-type date code: days since base.
pd : periodicity of data (or 0 if unknown).
d1904 : set to 1 if the base is 1904/01/01; otherwise the base is assumed to be 1899/12/31.
Returns : 0.

get_dec_date ()

double      get_dec_date                    (const char *date);

date : calendar representation of date.
Returns : representation of date as year plus fraction of year.

n_hidden_missing_obs ()

int         n_hidden_missing_obs            (const DATAINFO *pdinfo);

pdinfo :
Returns :

guess_daily_pd ()

int         guess_daily_pd                  (const DATAINFO *pdinfo);

pdinfo :
Returns :