GODateConventions: GOffice Reference Manual

## GODateConventions GODateConventions |

## Functions

void | go_coup_cd ()
double | go_coupdaybs ()
double | go_coupdays ()
double | go_coupdaysnc ()
gboolean | go_date_conv_equal ()
const GODateConventions * | go_date_conv_from_str ()
double | go_date_conv_translate ()
int | go_date_convention_base ()
gint32 | go_date_days_between_basis ()
int | go_date_g_months_between ()
int | go_date_g_to_serial ()
int | go_date_g_years_between ()
char * | go_date_month_name ()
int | go_date_serial_raw_to_seconds ()
int | go_date_serial_raw_to_serial ()
void | go_date_serial_to_g ()
time_t | go_date_serial_to_timet ()
int | go_date_timet_to_seconds ()
int | go_date_timet_to_serial ()
double | go_date_timet_to_serial_raw ()
char * | go_date_weekday_name ()
int | go_date_weeknum ()

## Types and Values

| GODateConventions
| GoCouponConvention
enum | GOBasisType

## Object Hierarchy

        GBoxed
        ╰── GODateConventions

## Description

## Functions

### go_coup_cd ()

    void
    go_coup_cd (GDate *res,
                GDate const *settle,
                GDate const *mat,
                int freq,
                gboolean eom,
                gboolean next);

### go_coupdaybs ()

    double
    go_coupdaybs (GDate const *settlement,
                  GDate const *maturity,
                  GoCouponConvention const *conv);

#### Parameters

settlement | GDate |
maturity | GDate |
conv | GoCouponConvention |

#### Returns

the number of days from the beginning of the coupon period to the settlement date.

### go_coupdays ()

    double
    go_coupdays (GDate const *settlement,
                 GDate const *maturity,
                 GoCouponConvention const *conv);

#### Parameters

settlement | GDate |
maturity | GDate |
conv | GoCouponConvention |

#### Returns

the number of days in the coupon period of the settlement date. Currently, returns negative numbers if the branch is not implemented.

### go_coupdaysnc ()

    double
    go_coupdaysnc (GDate const *settlement,
                   GDate const *maturity,
                   GoCouponConvention const *conv);

#### Parameters

conv | GoCouponConvention |

#### Returns

the number of days from the settlement date to the next coupon date.

### go_date_conv_equal ()

    gboolean
    go_date_conv_equal (const GODateConventions *a,
                        const GODateConventions *b);

### go_date_conv_from_str ()

    const GODateConventions *
    go_date_conv_from_str (const char *s);

### go_date_conv_translate ()

    double
    go_date_conv_translate (double f,
                            const GODateConventions *src,
                            const GODateConventions *dst);

### go_date_convention_base ()

    int
    go_date_convention_base (GODateConventions const *conv);

### go_date_days_between_basis ()

    gint32
    go_date_days_between_basis (GDate const *from,
                                GDate const *to,
                                GOBasisType basis);

### go_date_g_months_between ()

    int
    go_date_g_months_between (GDate const *date1,
                              GDate const *date2);

### go_date_g_to_serial ()

    int
    go_date_g_to_serial (GDate const *date,
                         GODateConventions const *conv);

### go_date_g_years_between ()

    int
    go_date_g_years_between (GDate const *date1,
                             GDate const *date2);

### go_date_month_name ()

    char *
    go_date_month_name (GDateMonth m,
                        gboolean abbrev);

### go_date_serial_raw_to_seconds ()

    int
    go_date_serial_raw_to_seconds (double raw);

### go_date_serial_raw_to_serial ()

    int
    go_date_serial_raw_to_serial (double raw);

### go_date_serial_to_g ()

    void
    go_date_serial_to_g (GDate *res,
                         int serial,
                         GODateConventions const *conv);

### go_date_serial_to_timet ()

    time_t
    go_date_serial_to_timet (int serial,
                             GODateConventions const *conv);

### go_date_timet_to_seconds ()

    int
    go_date_timet_to_seconds (time_t t);

### go_date_timet_to_serial ()

    int
    go_date_timet_to_serial (time_t t,
                             GODateConventions const *conv);

### go_date_timet_to_serial_raw ()

    double
    go_date_timet_to_serial_raw (time_t t,
                                 GODateConventions const *conv);

### go_date_weekday_name ()

    char *
    go_date_weekday_name (GDateWeekday wd,
                          gboolean abbrev);

### go_date_weeknum ()

    int
    go_date_weeknum (GDate const *date,
                     int method);

#### Parameters

date | date |
method | week numbering method |

#### Returns

week number according to the given method. 1: Week starts on Sunday. January 1 is in week 1. 2: Week starts on Monday. January 1 is in week 1. 150: ISO 8601 week number.

## Types and Values

### GODateConventions

    typedef struct {
    	gboolean use_1904; /* Use MacOffice 1904 based date convention,
    				 * Rather than the Win32 style 1900 */
    } GODateConventions;

#### Members

gboolean `use_1904`; | Base on 1904 as opposed to 1900. |

### GoCouponConvention

    typedef struct {
    	int	 freq;
    	GOBasisType  basis;
    	gboolean eom;
    	GODateConventions const *date_conv;
    } GoCouponConvention;

#### Members

int `freq`; | frequency. |
GOBasisType `basis`; | GOBasisType |
gboolean `eom`; | end of month. |
GODateConventions const *`date_conv`; | GODateConventions |

### enum GOBasisType

#### Members

GO_BASIS_MSRB_30_360 | US 30/360 (days in a month/days in a year) |
GO_BASIS_ACT_ACT | actual days/actual days |
GO_BASIS_ACT_360 | actual days/360 |
GO_BASIS_ACT_365 | actual days/365 |
GO_BASIS_30E_360 | European 30/360 |
GO_BASIS_30Ep_360 | ? |
GO_BASIS_MSRB_30_360_SYM | ? |