aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libical/ChangeLog8
-rw-r--r--libical/src/libical/icaltime.c7
2 files changed, 11 insertions, 4 deletions
diff --git a/libical/ChangeLog b/libical/ChangeLog
index d686ba26e7..0d70241538 100644
--- a/libical/ChangeLog
+++ b/libical/ChangeLog
@@ -1,5 +1,13 @@
2000-12-13 Federico Mena Quintero <federico@helixcode.com>
+ * src/libical/icaltime.c (icaltime_from_timet): Use gmtime()
+ unconditionally, since we want an UTC broken-down representation.
+ (icaltime_as_timet): Add the offset only if the time was supposed
+ to be in UTC; that way mktime() will get a proper localtime as
+ source data.
+
+2000-12-13 Federico Mena Quintero <federico@helixcode.com>
+
* src/libical/icaltime.c (icaltime_from_timet): time_t values
*are* in UTC by definition, so the is_utc argument is useless.
Removed the conversion to UTC and made the icaltimetype.is_utc be
diff --git a/libical/src/libical/icaltime.c b/libical/src/libical/icaltime.c
index 946a0115e9..4cdd3a9f0d 100644
--- a/libical/src/libical/icaltime.c
+++ b/libical/src/libical/icaltime.c
@@ -45,7 +45,7 @@ icaltime_from_timet(time_t tm, int is_date, int is_utc)
}
#endif
- t = *(localtime(&tm));
+ t = *(gmtime(&tm));
tt.second = t.tm_sec;
tt.minute = t.tm_min;
@@ -80,10 +80,9 @@ time_t icaltime_as_timet(struct icaltimetype tt)
stm.tm_isdst = -1; /* prevents mktime from changing hour based on
daylight savings */
- if(tt.is_utc == 0){
+ if(tt.is_utc)
stm.tm_sec -= icaltime_local_utc_offset();
- }
-
+
tut = mktime(&stm);
return tut;