On Wed, Mar 31, 2010 at 4:50 AM, Enlightenment SVN
<no-re...@enlightenment.org> wrote:
> Log:
>        * calendar: fix month decrease/increase.
>
> Author:       cedric
> Date:         2010-03-31 05:50:25 -0700 (Wed, 31 Mar 2010)
> New Revision: 47625
>
> Modified:
>  trunk/E-MODULES-EXTRA/calendar/src/e_mod_main.c
>
> Modified: trunk/E-MODULES-EXTRA/calendar/src/e_mod_main.c
> ===================================================================
> --- trunk/E-MODULES-EXTRA/calendar/src/e_mod_main.c     2010-03-31 12:38:58 
> UTC (rev 47624)
> +++ trunk/E-MODULES-EXTRA/calendar/src/e_mod_main.c     2010-03-31 12:50:25 
> UTC (rev 47625)
> @@ -341,7 +341,10 @@
>    inst->displayed_time.tm_mon--;
>    inst->displayed_time.tm_mday = 1;
>    if (inst->displayed_time.tm_mon < 0)
> -     inst->displayed_time.tm_mon = 11;
> +     {
> +       inst->displayed_time.tm_mon = 11;
> +       inst->displayed_time.tm_year--;
> +     }
>    _calendar_popup_content_update(inst);
>  }
>
> @@ -353,7 +356,10 @@
>    inst->displayed_time.tm_mon++;
>    inst->displayed_time.tm_mday = 1;
>    if (inst->displayed_time.tm_mon > 11)
> -     inst->displayed_time.tm_mon = 0;
> +     {
> +       inst->displayed_time.tm_mon = 0;
> +       inst->displayed_time.tm_year++;
> +     }
>    _calendar_popup_content_update(inst);
>  }

the best, easiest and safest way to do this is to use libc's date
manipulation functions such as gmtime() and localtime(). You can
increase/decrease on absolute basis using mktime() to convert to
seconds, then operate in seconds, and then convert back to the
break-down format to display.

By the way, we should have these functions in embryo, so our clock
could handle timezones feed to gadgets using offsets from gmt :-)

-- 
Gustavo Sverzut Barbieri
http://profusion.mobi embedded systems
--------------------------------------
MSN: barbi...@gmail.com
Skype: gsbarbieri
Mobile: +55 (19) 9225-2202

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to