Avoid Month wrapping by ignoring summer time correction.
authorShilpa Singh <shilpa.singh@samsung.com>
Thu, 6 Mar 2014 12:18:50 +0000 (21:18 +0900)
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>
Thu, 6 Mar 2014 12:23:17 +0000 (21:23 +0900)
Summary:
This patch fixes the issue of month wrapping due to summer time correction is some locales
by ignoring day light saving mode in mktime
Signed-off by: M.V.K Sumanth <sumanth.m@samsung.com>

@fix

Test Plan: Change the date for month were day light saving mode is applied and   observe the wrapping.

Reviewers: seoz, Hermet, raster

Reviewed By: raster

CC: govi, raster
Differential Revision: https://phab.enlightenment.org/D590

src/lib/elm_datetime.c

index f5df6bd210fe967de816abe3a67ca192a9a534df..ebb1abcc555c3f3f69005b68ba55a5a9141504d8 100644 (file)
@@ -577,14 +577,14 @@ _max_days_get(int year,
    localtime_r(&t, &time1);
    time1.tm_year = year;
    time1.tm_mon = month;
-   /* To restrict month wrapping because of summer time in some locales,
-    * disable day light saving mode.*/
-   time1.tm_isdst = 0;
    for (day = MIN_DAYS_IN_MONTH; day <= mapping[ELM_DATETIME_DATE].def_max;
         day++)
      {
         time1.tm_mday = day;
         mktime(&time1);
+        /* To restrict month wrapping because of summer time in some locales,
+        * ignore day light saving mode in mktime(). */
+        time1.tm_isdst = -1;
         if (time1.tm_mday == 1) break;
      }
    day--;