Commit 315ef49c authored by Jon Kåre Hellan's avatar Jon Kåre Hellan
Browse files

Added function ISOYEAR.

* plugins/fn-date/plugin.xml.in: Added function ISOYEAR.

* plugins/fn-date/functions.c (gnumeric_date, datedif_opt_yd, datedif_opt_md,
gnumeric_year, gnumeric_month, gnumeric_day, gnumeric_weekday,
gnumeric_days360, gnumeric_eomonth, gnumeric_workday, get_serial_weekday,
 networkdays_holiday_callback, gnumeric_networkdays): Replaced deprecated
g_date_xxx with g_data_get_xxx.
(gnumeric_isoweeknum): Cross reference ISOYEAR in docs.
(gnumeric_isoyear): New function implementing new spreadsheet funtion
ISOYEAR: The year an ISO 8601 week number refers to.

* plugins/fn-financial/functions.c (annual_year_basis, days_monthly_basis,
 coupnum): Replaced deprecated g_date_xxx with g_data_get_xxx.

* src/datetime.c (date_init, datetime_g_to_serial,
datetime_g_days_between, datetime_g_months_between, datetime_isoweeknum,
datetime_weeknum, days_between_BASIS_MSRB_30_360,
days_between_BASIS_30E_360, days_between_BASIS_30Ep_360,
days_between_basis, coup_cd): Ditto

* src/sheet-autofill.c (autofill_compute_delta): Ditto.
parent 69f5aca4
2002-07-07 Jon K Hellan <hellan@acm.org>
* src/datetime.c (date_init, datetime_g_to_serial,
datetime_g_days_between, datetime_g_months_between,
datetime_isoweeknum, datetime_weeknum,
days_between_BASIS_MSRB_30_360, days_between_BASIS_30E_360,
days_between_BASIS_30Ep_360, days_between_basis, coup_cd):
Replaced deprecated g_date_xxx with g_data_get_xxx.
* src/sheet-autofill.c (autofill_compute_delta): Ditto.
2002-07-01 Morten Welinder <terra@diku.dk>
* src/mathfunc.c (fact): Use table and avoid recursion.
......
......@@ -47,6 +47,7 @@ Jon K
* Use GsfInput in the Python plugin loader
* Use GsfInput in the Nautilus component
* Open all probe-able file formats from the Nautilus component
* Added ISOYEAR().
--------------------------------------------------------------------------
Gnumeric 1.1.4
......
2002-07-07 Jon K Hellan <hellan@acm.org>
* src/datetime.c (date_init, datetime_g_to_serial,
datetime_g_days_between, datetime_g_months_between,
datetime_isoweeknum, datetime_weeknum,
days_between_BASIS_MSRB_30_360, days_between_BASIS_30E_360,
days_between_BASIS_30Ep_360, days_between_basis, coup_cd):
Replaced deprecated g_date_xxx with g_data_get_xxx.
* src/sheet-autofill.c (autofill_compute_delta): Ditto.
2002-07-01 Morten Welinder <terra@diku.dk>
* src/mathfunc.c (fact): Use table and avoid recursion.
......
2002-07-07 Jon K Hellan <hellan@acm.org>
* src/datetime.c (date_init, datetime_g_to_serial,
datetime_g_days_between, datetime_g_months_between,
datetime_isoweeknum, datetime_weeknum,
days_between_BASIS_MSRB_30_360, days_between_BASIS_30E_360,
days_between_BASIS_30Ep_360, days_between_basis, coup_cd):
Replaced deprecated g_date_xxx with g_data_get_xxx.
* src/sheet-autofill.c (autofill_compute_delta): Ditto.
2002-07-01 Morten Welinder <terra@diku.dk>
* src/mathfunc.c (fact): Use table and avoid recursion.
......
2002-07-07 Jon K Hellan <hellan@acm.org>
* plugin.xml.in: Added function ISOYEAR.
* functions.c (gnumeric_date, datedif_opt_yd, datedif_opt_md,
gnumeric_year, gnumeric_month, gnumeric_day, gnumeric_weekday,
gnumeric_days360, gnumeric_eomonth, gnumeric_workday,
get_serial_weekday, networkdays_holiday_callback,
gnumeric_networkdays): Replaced deprecated g_date_xxx with
g_data_get_xxx.
(gnumeric_isoweeknum): Cross reference ISOYEAR in docs.
(gnumeric_isoyear): New function implementing new spreadsheet
funtion ISOYEAR: The year an ISO 8601 week number refers to.
2002-05-29 Jody Goldberg <jody@gnome.org>
* Release 1.1.4
......
......@@ -107,7 +107,7 @@ gnumeric_date (FunctionEvalInfo *ei, Value **argv)
if (!g_date_valid (&date))
goto error;
if (g_date_year (&date) < 1900 || g_date_year (&date) >= 11900)
if (g_date_get_year (&date) < 1900 || g_date_get_year (&date) >= 11900)
goto error;
return value_new_int (datetime_g_to_serial (&date));
......@@ -248,10 +248,10 @@ datedif_opt_yd (GDate *gdate1, GDate *gdate2, int excel_compat)
g_assert (g_date_valid (gdate1));
g_assert (g_date_valid (gdate2));
day = g_date_day (gdate1);
day = g_date_get_day (gdate1);
g_date_add_years (gdate1,
datetime_g_years_between (gdate1, gdate2));
datetime_g_years_between (gdate1, gdate2));
/* according to glib.h, feb 29 turns to feb 28 if necessary */
if (excel_compat) {
......@@ -260,9 +260,9 @@ datedif_opt_yd (GDate *gdate1, GDate *gdate2, int excel_compat)
/* treat all years divisible by four as leap years: */
/* this is clearly wrong, but it's what Excel does. */
/* (I use 2004 here since it is clearly a leap year.) */
new_year1 = 2004 + (g_date_year (gdate1) & 0x3);
new_year2 = new_year1 + (g_date_year (gdate2) -
g_date_year (gdate1));
new_year1 = 2004 + (g_date_get_year (gdate1) & 0x3);
new_year2 = new_year1 + (g_date_get_year (gdate2) -
g_date_get_year (gdate1));
g_date_set_year (gdate1, new_year1);
g_date_set_year (gdate2, new_year2);
......@@ -287,7 +287,7 @@ datedif_opt_md (GDate *gdate1, GDate *gdate2, int excel_compat)
g_assert (g_date_valid (gdate1));
g_assert (g_date_valid (gdate2));
day = g_date_day (gdate1);
day = g_date_get_day (gdate1);
g_date_add_months (gdate1,
datetime_g_months_between (gdate1, gdate2));
......@@ -299,9 +299,9 @@ datedif_opt_md (GDate *gdate1, GDate *gdate2, int excel_compat)
/* treat all years divisible by four as leap years: */
/* this is clearly wrong, but it's what Excel does. */
/* (I use 2004 here since it is clearly a leap year.) */
new_year1 = 2004 + (g_date_year (gdate1) & 0x3);
new_year2 = new_year1 + (g_date_year (gdate2) -
g_date_year (gdate1));
new_year1 = 2004 + (g_date_get_year (gdate1) & 0x3);
new_year2 = new_year1 + (g_date_get_year (gdate2) -
g_date_get_year (gdate1));
g_date_set_year (gdate1, new_year1);
g_date_set_year (gdate2, new_year2);
......@@ -310,7 +310,7 @@ datedif_opt_md (GDate *gdate1, GDate *gdate2, int excel_compat)
/* ( i feel this is inferior because it reports e.g.:
datedif(1/31/95,3/1/95,"d") == -2 ) */
g_date_add_days (gdate1,
day - g_date_day (gdate1));
day - g_date_get_day (gdate1));
}
return datetime_g_days_between (gdate1, gdate2);
......@@ -656,7 +656,7 @@ gnumeric_year (FunctionEvalInfo *ei, Value **argv)
date = datetime_value_to_g (argv[0]);
if (date != NULL) {
res = g_date_year (date);
res = g_date_get_year (date);
g_date_free (date);
}
return value_new_int (res);
......@@ -693,7 +693,7 @@ gnumeric_month (FunctionEvalInfo *ei, Value **argv)
date = datetime_value_to_g (argv[0]);
if (date != NULL) {
res = g_date_month (date);
res = g_date_get_month (date);
g_date_free (date);
}
return value_new_int (res);
......@@ -730,7 +730,7 @@ gnumeric_day (FunctionEvalInfo *ei, Value **argv)
date = datetime_value_to_g (argv[0]);
if (date != NULL) {
res = g_date_day (date);
res = g_date_get_day (date);
g_date_free (date);
}
return value_new_int (res);
......@@ -778,9 +778,9 @@ gnumeric_weekday (FunctionEvalInfo *ei, Value **argv)
return value_new_error (ei->pos, gnumeric_err_VALUE);
switch (method) {
case 1: res = (g_date_weekday (date) % 7) + 1; break;
case 2: res = (g_date_weekday (date) + 6) % 7 + 1; break;
case 3: res = (g_date_weekday (date) + 6) % 7; break;
case 1: res = (g_date_get_weekday (date) % 7) + 1; break;
case 2: res = (g_date_get_weekday (date) + 6) % 7 + 1; break;
case 3: res = (g_date_get_weekday (date) + 6) % 7; break;
default: abort ();
}
......@@ -848,12 +848,12 @@ gnumeric_days360 (FunctionEvalInfo *ei, Value **argv)
date1 = datetime_serial_to_g (serial1);
date2 = datetime_serial_to_g (serial2);
day1 = g_date_day (date1);
day2 = g_date_day (date2);
month1 = g_date_month (date1);
month2 = g_date_month (date2);
year1 = g_date_year (date1);
year2 = g_date_year (date2);
day1 = g_date_get_day (date1);
day2 = g_date_get_day (date2);
month1 = g_date_get_month (date1);
month2 = g_date_get_month (date2);
year1 = g_date_get_year (date1);
year2 = g_date_get_year (date2);
switch (method) {
case METHOD_US:
......@@ -934,8 +934,8 @@ gnumeric_eomonth (FunctionEvalInfo *ei, Value **argv)
else if (months < 0)
g_date_subtract_months(date, -months);
g_date_set_day(date, g_date_days_in_month(g_date_month(date),
g_date_year(date)));
g_date_set_day(date, g_date_get_days_in_month(g_date_get_month(date),
g_date_get_year(date)));
res = value_new_int (datetime_g_to_serial (date));
g_date_free (date);
......@@ -977,7 +977,7 @@ gnumeric_workday (FunctionEvalInfo *ei, Value **argv)
date = datetime_value_to_g (argv[0]);
if (date == NULL || !g_date_valid (date))
return value_new_error (ei->pos, gnumeric_err_VALUE);
weekday = g_date_weekday (date);
weekday = g_date_get_weekday (date);
days = value_get_as_int (argv[1]);
......@@ -1048,7 +1048,7 @@ get_serial_weekday (int serial, int * offset)
date = datetime_serial_to_g (serial);
if (g_date_valid (date)) {
/* Jan 1 1900 was a monday so we won't go < 0 */
*offset = (int)g_date_weekday (date) - 1;
*offset = (int)g_date_get_weekday (date) - 1;
serial -= *offset;
if (*offset > 4)
*offset = 4;
......@@ -1085,7 +1085,7 @@ networkdays_holiday_callback(EvalPos const *ep,
date = datetime_serial_to_g (serial);
if (g_date_valid (date)) {
if (g_date_weekday (date) < G_DATE_SATURDAY)
if (g_date_get_weekday (date) < G_DATE_SATURDAY)
++close->res;
} else
res = value_new_error (ep, gnumeric_err_NUM);
......@@ -1142,7 +1142,7 @@ gnumeric_networkdays (FunctionEvalInfo *ei, Value **argv)
res = res - start_offset + end_offset - close.res;
if (g_date_weekday (start_date) < G_DATE_SATURDAY)
if (g_date_get_weekday (start_date) < G_DATE_SATURDAY)
res++;
datetime_g_free (start_date);
......@@ -1164,12 +1164,13 @@ static const char *help_isoweeknum = {
"week including days from two different years is assigned to the "
"year which includes the most days. This means that Dec 31 could "
"be in week 1 of the following year, and Jan 1 could be in week 52 "
"or 53 of the previous year."
"or 53 of the previous year. ISOWEEKNUM returns the week number, "
"while ISOYEAR returns the year the week is assigned to."
"\n"
"@EXAMPLES=\n"
"If A1 contains 12/21/00 then ISOWEEKNUM(A1)=51"
"\n"
"@SEEALSO=WEEKNUM")
"@SEEALSO=WEEKNUM, ISOYEAR")
};
static Value *
......@@ -1195,6 +1196,61 @@ gnumeric_isoweeknum (FunctionEvalInfo *ei, Value **argv)
/***************************************************************************/
static const char *help_isoyear = {
N_("@FUNCTION=ISOYEAR\n"
"@SYNTAX=ISOYEAR (date)\n"
"@DESCRIPTION="
"ISOYEAR returns the year of the ISO 8601 week number of @date."
"\n"
"Returns #NUM! if date is invalid."
"\n"
"An ISO 8601 week starts on Monday. Weeks are numbered from 1. A "
"week including days from two different years is assigned to the "
"year which includes the most days. This means that Dec 31 could "
"be in week 1 of the following year, and Jan 1 could be in week 52 "
"or 53 of the previous year. ISOYEAR returns the year the week is "
"assigned to, while ISOWEEKNUM returns the week number."
"\n"
"@EXAMPLES=\n"
"If A1 contains 12/31/2001 then ISOYEAR(A1)=2002"
"\n"
"@SEEALSO=ISOWEEKNUM")
};
static Value *
gnumeric_isoyear (FunctionEvalInfo *ei, Value **argv)
{
Value *res;
GDate *date;
int isoyear;
int year;
int month;
int isoweeknum;
if (argv[0]->type == VALUE_ERROR)
return value_duplicate (argv[0]);
date = datetime_value_to_g (argv[0]);
if (date == NULL || !g_date_valid (date))
return value_new_error (ei->pos, gnumeric_err_VALUE);
isoweeknum = datetime_weeknum (date, WEEKNUM_METHOD_ISO);
year = g_date_get_year (date);
month = g_date_get_month (date);
if (isoweeknum >= 52 && month == G_DATE_JANUARY)
year--;
else if (isoweeknum == 1 && month == G_DATE_DECEMBER)
year++;
res = value_new_int (year);
g_date_free (date);
return res;
}
/***************************************************************************/
static const char *help_weeknum = {
N_("@FUNCTION=WEEKNUM\n"
"@SYNTAX=WEEKNUM (date, method)\n"
......@@ -1273,6 +1329,7 @@ const ModulePluginFunctionInfo datetime_functions[] = {
{ "workday", "Sf|?", "date,days,holidays", &help_workday, gnumeric_workday, NULL, NULL, NULL },
{ "year", "S", "date", &help_year, gnumeric_year, NULL, NULL, NULL },
{ "isoweeknum", "S", "date", &help_isoweeknum, gnumeric_isoweeknum, NULL, NULL, NULL },
{ "isoyear", "S", "date", &help_isoyear, gnumeric_isoyear, NULL, NULL, NULL },
{ "weeknum", "S|f", "date", &help_weeknum, gnumeric_weeknum, NULL, NULL, NULL },
{NULL}
};
......
......@@ -33,6 +33,7 @@
<function name="workday"/>
<function name="year"/>
<function name="isoweeknum"/>
<function name="isoyear"/>
<function name="weeknum"/>
</functions>
</service>
......
2002-07-07 Jon K Hellan <hellan@acm.org>
* functions.c (annual_year_basis, days_monthly_basis, coupnum):
Replaced deprecated g_date_xxx with g_data_get_xxx.
2002-07-07 Jukka Pekka <jiivonen@hutcs.cs.hut.fi>
* functions (gnumeric_cumprinc, gnumeric_cumipmt, gnumeric_mduration):
......
......@@ -169,7 +169,8 @@ annual_year_basis (Value *value_date, int basis)
case 1:
date = datetime_value_to_g (value_date);
if (date != NULL) {
leap_year = g_date_is_leap_year (g_date_year (date));
leap_year =
g_date_is_leap_year (g_date_get_year (date));
g_date_free (date);
} else
return -1;
......@@ -209,12 +210,12 @@ days_monthly_basis (Value *issue_date, Value *maturity_date, int basis)
date_i = datetime_value_to_g (issue_date);
date_m = datetime_value_to_g (maturity_date);
if (date_i != NULL && date_m != NULL) {
issue_year = g_date_year (date_i);
issue_month = g_date_month (date_i);
issue_day = g_date_day (date_i);
maturity_year = g_date_year (date_m);
maturity_month = g_date_month (date_m);
maturity_day = g_date_day (date_m);
issue_year = g_date_get_year (date_i);
issue_month = g_date_get_month (date_i);
issue_day = g_date_get_day (date_i);
maturity_year = g_date_get_year (date_m);
maturity_month = g_date_get_month (date_m);
maturity_day = g_date_get_day (date_m);
years = maturity_year - issue_year;
months = maturity_month - issue_month;
......@@ -267,10 +268,11 @@ coupnum (GDate *settlement, GDate *maturity, int freq, basis_t basis,
GDate this_coupondate;
g_date_clear (&this_coupondate, 1);
g_date_set_julian (&this_coupondate, g_date_julian(maturity));
g_date_set_julian (&this_coupondate, g_date_get_julian(maturity));
months = g_date_month (maturity) - g_date_month (settlement) +
12 * (g_date_year (maturity) - g_date_year (settlement));
months = g_date_get_month (maturity) - g_date_get_month (settlement) +
12 *
(g_date_get_year (maturity) - g_date_get_year (settlement));
g_date_subtract_months (&this_coupondate, months);
......@@ -278,7 +280,7 @@ coupnum (GDate *settlement, GDate *maturity, int freq, basis_t basis,
while (!g_date_is_last_of_month (&this_coupondate))
g_date_add_days (&this_coupondate, 1);
if (g_date_day (settlement) >= g_date_day (&this_coupondate))
if (g_date_get_day (settlement) >= g_date_get_day (&this_coupondate))
months--;
return (1 + months / (12 / freq));
......
......@@ -35,7 +35,7 @@ date_init (void)
{
/* Day 1 means 1st of January of 1900 */
GDate* date = g_date_new_dmy (1, 1, 1900);
date_origin = g_date_julian (date) - 1;
date_origin = g_date_get_julian (date) - 1;
g_date_free (date);
}
......@@ -49,7 +49,7 @@ datetime_g_to_serial (GDate *date)
if (!date_origin)
date_init ();
day = g_date_julian (date) - date_origin;
day = g_date_get_julian (date) - date_origin;
return day + (day > date_serial_19000228);
}
......@@ -205,7 +205,7 @@ datetime_g_days_between (GDate* date1, GDate *date2)
g_assert (g_date_valid (date1));
g_assert (g_date_valid (date2));
return (int) (g_date_julian (date2) - g_date_julian (date1));
return (int) (g_date_get_julian (date2) - g_date_get_julian (date1));
}
/* ------------------------------------------------------------------------- */
......@@ -218,9 +218,9 @@ datetime_g_months_between (GDate *date1, GDate *date2)
/* find the difference according to the month and year ordinals,
but discount the last month if there are not enough days. */
return 12 * (g_date_year (date2) - g_date_year (date1))
+ g_date_month (date2) - g_date_month (date1)
- (g_date_day (date2) >= g_date_day (date1) ? 0 : 1);
return 12 * (g_date_get_year (date2) - g_date_get_year (date1))
+ g_date_get_month (date2) - g_date_get_month (date1)
- (g_date_get_day (date2) >= g_date_get_day (date1) ? 0 : 1);
}
/* ------------------------------------------------------------------------- */
......@@ -255,12 +255,12 @@ datetime_isoweeknum (GDate *date)
g_assert (g_date_valid (date));
year = g_date_year (date);
wday = g_date_weekday (date);
year = g_date_get_year (date);
wday = g_date_get_weekday (date);
g_date_set_dmy (&jan1date, 1, 1, year);
jan1wday = g_date_weekday (&jan1date);
jan1wday = g_date_get_weekday (&jan1date);
week = g_date_monday_week_of_year (date);
week = g_date_get_monday_week_of_year (date);
/* Does date belong to last week of previous year? */
if ((week == 0) && (jan1wday > G_DATE_THURSDAY)) {
......@@ -275,7 +275,7 @@ datetime_isoweeknum (GDate *date)
if (week == 53) {
g_date_set_dmy (&nextjan1date, 1, 1, year + 1);
nextjan1wday = g_date_weekday (&nextjan1date);
nextjan1wday = g_date_get_weekday (&nextjan1date);
if (nextjan1wday <= G_DATE_THURSDAY)
week = 1;
}
......@@ -307,9 +307,9 @@ datetime_weeknum (GDate *date, int method)
switch (method) {
case WEEKNUM_METHOD_SUNDAY:
res = g_date_sunday_week_of_year (date); break;
res = g_date_get_sunday_week_of_year (date); break;
case WEEKNUM_METHOD_MONDAY:
res = g_date_monday_week_of_year (date); break;
res = g_date_get_monday_week_of_year (date); break;
case WEEKNUM_METHOD_ISO:
res = datetime_isoweeknum (date); break;
default: res = -1;
......@@ -325,12 +325,12 @@ days_between_BASIS_MSRB_30_360 (GDate *from, GDate *to)
{
int y1, m1, d1, y2, m2, d2;
y1 = g_date_year (from);
m1 = g_date_month (from);
d1 = g_date_day (from);
y2 = g_date_year (to);
m2 = g_date_month (to);
d2 = g_date_day (to);
y1 = g_date_get_year (from);
m1 = g_date_get_month (from);
d1 = g_date_get_day (from);
y2 = g_date_get_year (to);
m2 = g_date_get_month (to);
d2 = g_date_get_day (to);
if (d1 >= 30) {
d1 = 30;
......@@ -346,12 +346,12 @@ days_between_BASIS_30E_360 (GDate *from, GDate *to)
{
int y1, m1, d1, y2, m2, d2;
y1 = g_date_year (from);
m1 = g_date_month (from);
d1 = g_date_day (from);
y2 = g_date_year (to);
m2 = g_date_month (to);
d2 = g_date_day (to);
y1 = g_date_get_year (from);
m1 = g_date_get_month (from);
d1 = g_date_get_day (from);
y2 = g_date_get_year (to);
m2 = g_date_get_month (to);
d2 = g_date_get_day (to);
if (d1 == 31)
d1 = 30;
......@@ -366,12 +366,12 @@ days_between_BASIS_30Ep_360 (GDate *from, GDate *to)
{
int y1, m1, d1, y2, m2, d2;
y1 = g_date_year (from);
m1 = g_date_month (from);
d1 = g_date_day (from);
y2 = g_date_year (to);
m2 = g_date_month (to);
d2 = g_date_day (to);
y1 = g_date_get_year (from);
m1 = g_date_get_month (from);
d1 = g_date_get_day (from);
y2 = g_date_get_year (to);
m2 = g_date_get_month (to);
d2 = g_date_get_day (to);
if (d1 == 31)
d1 = 30;
......@@ -412,7 +412,7 @@ days_between_basis (GDate *from, GDate *to, int basis)
case BASIS_ACT_ACT:
case BASIS_ACT_360:
case BASIS_ACT_365:
return (g_date_julian (to) - g_date_julian (from));
return (g_date_get_julian (to) - g_date_get_julian (from));
break;
case BASIS_30E_360:
return days_between_BASIS_30E_360 (from, to);
......@@ -454,14 +454,14 @@ coup_cd (GDate *settlement, GDate *maturity, int freq, gboolean eom, gboolean ne
is_eom_special = eom && g_date_is_last_of_month (maturity);
months = 12 / freq;
periods = (g_date_year(maturity) - g_date_year (settlement));
periods = (g_date_get_year(maturity) - g_date_get_year (settlement));
if (periods > 0)
periods = (periods - 1) * freq;
result = g_date_new();
do {
g_date_set_julian (result, g_date_julian (maturity));
g_date_set_julian (result, g_date_get_julian (maturity));
periods++;
g_date_subtract_months (result, periods * months);
if (is_eom_special) {
......@@ -473,7 +473,7 @@ coup_cd (GDate *settlement, GDate *maturity, int freq, gboolean eom, gboolean ne
} while (g_date_compare (settlement, result) < 0 );
if (next) {
g_date_set_julian (result, g_date_julian (maturity));
g_date_set_julian (result, g_date_get_julian (maturity));
periods--;
g_date_subtract_months (result, periods * months);
if (is_eom_special) {
......
......@@ -375,19 +375,21 @@ autofill_compute_delta (GList *list_last, gboolean singleton_increment)
prev = datetime_value_to_g (lfi->v.value);
cur = datetime_value_to_g (fi->v.value);
if (g_date_valid (prev) && g_date_valid (cur)) {
int a = g_date_year (prev);
int b = g_date_year (cur);
int a = g_date_get_year (prev);
int b = g_date_get_year (cur);
/* look for patterns in the dates */
if (fi->type == FILL_DAYS)
fi->type = (g_date_day (prev) != g_date_day (cur))
fi->type = (g_date_get_day (prev) !=
g_date_get_day (cur))
? FILL_NUMBER
: ((g_date_month (prev) != g_date_month (cur))
: ((g_date_get_month (prev) !=
g_date_get_month (cur))
? FILL_MONTHS : FILL_YEARS);
if (fi->type == FILL_MONTHS) {
a = 12*a + g_date_month (prev);
b = 12*b + g_date_month (cur);
a = 12*a + g_date_get_month (prev);
b = 12*b + g_date_get_month (cur);
}
fi->delta.d_int = b - a;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment