freebsd-ports/lang/see/files/patch-libsee_obj__Date.c
Renato Botelho a3e270a910 - Fix: If summer-time daylight saving is in effect, getHours() returns
wrong value.
- Change .if defined(WITH_GC) -> ;if !defined(WITHOUT_GC) since it's on
  by default.

PR:		ports/94996
Submitted by:	maintainer
2006-04-11 15:39:41 +00:00

35 lines
950 B
C

--- libsee/obj_Date.c.orig Wed Jan 18 13:51:50 2006
+++ libsee/obj_Date.c Mon Mar 27 10:56:41 2006
@@ -2167,20 +2167,12 @@
DaylightSavingTA(t)
SEE_number_t t;
{
- SEE_number_t ysec = t - TimeFromYear((SEE_number_t)YearFromTime(t));
- int ily = InLeapYear(t);
- int wstart = WeekDay(TimeFromYear((SEE_number_t)YearFromTime(t)));
- int equiv_year = yearmap[ily][wstart];
struct tm tm;
time_t dst_time, nodst_time;
+ time_t tt;
+ tt=t/1000;
+ tm=*localtime(&tt);
- memset(&tm, 0, sizeof tm);
- tm.tm_sec = SecFromTime(ysec);
- tm.tm_min = MinFromTime(ysec);
- tm.tm_hour = HourFromTime(ysec);
- tm.tm_mday = DateFromTime(ysec);
- tm.tm_mon = MonthFromTime(ysec) - 1;
- tm.tm_year = equiv_year - 1900;
tm.tm_isdst = -1;
if (tm.tm_isdst == 0) return 0;
@@ -2189,7 +2181,7 @@
tm.tm_isdst = 0;
nodst_time = mktime(&tm);
- return (dst_time - nodst_time) * 1000;
+ return -(dst_time - nodst_time) * 1000;
}
static void