projects
/
platform
/
upstream
/
glib.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
026375b
)
datetime: Fix a thinko
author
Emmanuele Bassi
<ebassi@linux.intel.com>
Wed, 25 Aug 2010 22:08:18 +0000
(23:08 +0100)
committer
Emmanuele Bassi
<ebassi@linux.intel.com>
Wed, 25 Aug 2010 22:08:18 +0000
(23:08 +0100)
We need to check if a year is a leap one *after* we increased it with
the given value, not before.
glib/gdatetime.c
patch
|
blob
|
history
diff --git
a/glib/gdatetime.c
b/glib/gdatetime.c
index c7972b4456aa61e571c39174f65730e3c8076f83..baf0c5ff7b9055cc511072c2f3963d00d9939568 100644
(file)
--- a/
glib/gdatetime.c
+++ b/
glib/gdatetime.c
@@
-357,6
+357,8
@@
g_date_time_add_dmy (GDateTime *datetime,
gint step, i;
const guint16 *max_days;
+ __year += years;
+
/* subtract one day for leap years */
if (GREGORIAN_LEAP (__year) && __month == 2)
{
@@
-364,8
+366,6
@@
g_date_time_add_dmy (GDateTime *datetime,
__day -= 1;
}
- __year += years;
-
/* add months */
step = months > 0 ? 1 : -1;
for (i = 0; i < ABS (months); i++)