aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2002-07-23 21:57:51 +0800
committerDan Winship <danw@src.gnome.org>2002-07-23 21:57:51 +0800
commitef4b84d6d43b7347e741e6307267df54c3e34ca5 (patch)
tree174ec8f98ddcf66449970dfdfcc074dbf4b543b9
parent122a24ce8f71aba4b3e5c12581c6e66a3ad14c73 (diff)
downloadgsoc2013-evolution-ef4b84d6d43b7347e741e6307267df54c3e34ca5.tar.gz
gsoc2013-evolution-ef4b84d6d43b7347e741e6307267df54c3e34ca5.tar.zst
gsoc2013-evolution-ef4b84d6d43b7347e741e6307267df54c3e34ca5.zip
Replace a bunch of old gnomecal functions with the functionally identical
* cal-util/timeutil.c: Replace a bunch of old gnomecal functions with the functionally identical ones from Connector. svn path=/trunk/; revision=17548
-rw-r--r--calendar/ChangeLog3
-rw-r--r--calendar/cal-util/timeutil.c45
2 files changed, 14 insertions, 34 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index af75d5fda3..7a88b874ad 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -6,6 +6,9 @@
backend shouldn't be calling functions from the existing backends
anyway so there's no reason to install them.
+ * cal-util/timeutil.c: Replace a bunch of old gnomecal functions
+ with the functionally identical ones from Connector.
+
2002-07-18 Rodrigo Moya <rodrigo@ximian.com>
* importers/icalendar-importer.c (get_uri_from_folder_path): if
diff --git a/calendar/cal-util/timeutil.c b/calendar/cal-util/timeutil.c
index 3dcf8dc384..f909022565 100644
--- a/calendar/cal-util/timeutil.c
+++ b/calendar/cal-util/timeutil.c
@@ -1,7 +1,6 @@
/* Miscellaneous time-related utilities
*
- * Copyright (C) 1998 The Free Software Foundation
- * Copyright (C) 2000 Ximian, Inc.
+ * Copyright (C) 2000, 2001 Ximian, Inc.
*
* Authors: Federico Mena <federico@ximian.com>
* Miguel de Icaza <miguel@ximian.com>
@@ -38,16 +37,6 @@ static const int days_in_month[12] = {
* icaltimetype values rather than time_t values wherever possible.
**************************************************************************/
-static void
-print_time_t (time_t t)
-{
- struct tm *tm = localtime (&t);
-
- printf ("%d/%02d/%02d %02d:%02d:%02d",
- 1900 + tm->tm_year, tm->tm_mon+1, tm->tm_mday,
- tm->tm_hour, tm->tm_min, tm->tm_sec);
-}
-
/* Adds a day onto the time, using local time.
Note that if clocks go forward due to daylight savings time, there are
some non-existent local times, so the hour may be changed to make it a
@@ -58,21 +47,13 @@ print_time_t (time_t t)
time_t
time_add_day (time_t time, int days)
{
- struct tm *tm = localtime (&time);
- time_t new_time;
+ struct tm *tm;
+ tm = localtime (&time);
tm->tm_mday += days;
tm->tm_isdst = -1;
- if ((new_time = mktime (tm)) == -1) {
- g_message ("time_add_day(): mktime() could not handling adding %d days with\n",
- days);
- print_time_t (time);
- printf ("\n");
- return time;
- }
-
- return new_time;
+ return mktime (tm);
}
time_t
@@ -88,9 +69,7 @@ time_day_begin (time_t t)
struct tm tm;
tm = *localtime (&t);
- tm.tm_hour = 0;
- tm.tm_min = 0;
- tm.tm_sec = 0;
+ tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
tm.tm_isdst = -1;
return mktime (&tm);
@@ -103,10 +82,8 @@ time_day_end (time_t t)
struct tm tm;
tm = *localtime (&t);
+ tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
tm.tm_mday++;
- tm.tm_hour = 0;
- tm.tm_min = 0;
- tm.tm_sec = 0;
tm.tm_isdst = -1;
return mktime (&tm);
@@ -454,12 +431,12 @@ time_leap_years_up_to (int year)
char *
isodate_from_time_t (time_t t)
{
- struct tm *tm;
- char isotime[40];
+ gchar *ret;
+
+ ret = g_malloc (17); /* 4+2+2+1+2+2+2+1 + 1 */
+ strftime (ret, 17, "%Y%m%dT%H%M%SZ", gmtime (&t));
- tm = gmtime (&t);
- strftime (isotime, sizeof (isotime)-1, "%Y%m%dT%H%M%SZ", tm);
- return g_strdup (isotime);
+ return ret;
}
/**