1 #ifndef _GNM_DATETIME_H_
2 # define _GNM_DATETIME_H_
3 
4 #include <gnumeric.h>
5 #include <numbers.h>
6 #include <goffice/goffice.h>
7 
8 G_BEGIN_DECLS
9 
10 gboolean gnm_datetime_allow_negative (void);
11 
12 gnm_float datetime_value_to_serial_raw (GnmValue const *v, GODateConventions const *conv);
13 int	  datetime_value_to_seconds    (GnmValue const *v, GODateConventions const *conv);
14 
15 /* These are date-only, no time.  */
16 gboolean datetime_value_to_g		(GDate *res, GnmValue const *v, GODateConventions const *conv);
17 int      datetime_value_to_serial	(GnmValue const *v, GODateConventions const *conv);
18 
19 int     annual_year_basis  (GnmValue const *value_date, GOBasisType basis,
20 			    GODateConventions const *date_conv);
21 gnm_float yearfrac (GDate const *from, GDate const *to, GOBasisType basis);
22 
23 void gnm_date_add_days (GDate *d, int n);
24 void gnm_date_add_months (GDate *d, int n);
25 void gnm_date_add_years (GDate *d, int n);
26 
27 #define GNM_DATE_BASIS_HELP							\
28 	{ GNM_FUNC_HELP_NOTE, F_("If @{basis} is 0, then the US 30/360 method is used.") }, \
29 	{ GNM_FUNC_HELP_NOTE, F_("If @{basis} is 1, then actual number of days is used.") }, \
30 	{ 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.") }, \
31 	{ 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.") }, \
32 	{ GNM_FUNC_HELP_NOTE, F_("If @{basis} is 4, then the European 30/360 method is used.") },
33 
34 
35 G_END_DECLS
36 
37 #endif /* _GNM_DATETIME_H_ */
38