gnm-datetime.h 1.59 KB
Newer Older
1 2 3
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
#ifndef _GNM_DATETIME_H_
# define _GNM_DATETIME_H_
4 5

#include "gnumeric.h"
Morten Welinder's avatar
Morten Welinder committed
6
#include "numbers.h"
7
#include <goffice/goffice.h>
8 9 10

G_BEGIN_DECLS

11 12
gboolean gnm_datetime_allow_negative (void);

Morten Welinder's avatar
Morten Welinder committed
13
gnm_float datetime_value_to_serial_raw (GnmValue const *v, GODateConventions const *conv);
Jody Goldberg's avatar
Jody Goldberg committed
14
int	  datetime_value_to_seconds    (GnmValue const *v, GODateConventions const *conv);
15 16 17 18 19

/* These are date-only, no time.  */
gboolean datetime_value_to_g		(GDate *res, GnmValue const *v, GODateConventions const *conv);
int      datetime_value_to_serial	(GnmValue const *v, GODateConventions const *conv);

20
int     annual_year_basis  (GnmValue const *value_date, go_basis_t basis,
21
			    GODateConventions const *date_conv);
22
gnm_float yearfrac (GDate const *from, GDate const *to, go_basis_t basis);
23

Morten Welinder's avatar
Morten Welinder committed
24 25 26
void gnm_date_add_days (GDate *d, int n);
void gnm_date_add_months (GDate *d, int n);
void gnm_date_add_years (GDate *d, int n);
27

28 29 30 31 32 33 34 35
#define GNM_DATE_BASIS_HELP							\
	{ GNM_FUNC_HELP_NOTE, F_("If @{basis} is 0, then the US 30/360 method is used.") }, \
	{ GNM_FUNC_HELP_NOTE, F_("If @{basis} is 1, then actual number of days is used.") }, \
	{ GNM_FUNC_HELP_NOTE, F_("If @{basis} is 2, then actual number of days is used within a month, but years are considered only 360 days.") }, \
	{ GNM_FUNC_HELP_NOTE, F_("If @{basis} is 3, then actual number of days is used within a month, but years are always considered 365 days.") }, \
	{ GNM_FUNC_HELP_NOTE, F_("If @{basis} is 4, then the European 30/360 method is used.") },


36 37
G_END_DECLS

38
#endif /* _GNM_DATETIME_H_ */