libsoup r1154 - in trunk: . libsoup
- From: hadess svn gnome org
- To: svn-commits-list gnome org
- Subject: libsoup r1154 - in trunk: . libsoup
- Date: Fri, 22 Aug 2008 14:13:56 +0000 (UTC)
Author: hadess
Date: Fri Aug 22 14:13:56 2008
New Revision: 1154
URL: http://svn.gnome.org/viewvc/libsoup?rev=1154&view=rev
Log:
2008-08-22 Bastien Nocera <hadess hadess net>
* libsoup/soup-date.c (soup_date_to_time_t),
(soup_date_to_timeval):
* libsoup/soup-date.h: Add a SoupDate to GTimeVal conversion
function, for use in gvfs. #549006, with help from Dan Winship
<danw gnome org>
Modified:
trunk/ChangeLog
trunk/libsoup/soup-date.c
trunk/libsoup/soup-date.h
Modified: trunk/libsoup/soup-date.c
==============================================================================
--- trunk/libsoup/soup-date.c (original)
+++ trunk/libsoup/soup-date.c Fri Aug 22 14:13:56 2008
@@ -542,6 +542,7 @@
soup_date_to_time_t (SoupDate *date)
{
time_t tt;
+ GTimeVal val;
/* FIXME: offset, etc */
@@ -557,8 +558,8 @@
if (sizeof (time_t) == 4 && date->year > 2038)
return (time_t)0x7fffffff;
- tt = rata_die_day (date) - TIME_T_EPOCH_RATA_DIE_DAY;
- tt = ((((tt * 24) + date->hour) * 60) + date->minute) * 60 + date->second;
+ soup_date_to_timeval (date, &val);
+ tt = val.tv_sec;
if (sizeof (time_t) == 4 && tt < 0)
return (time_t)0x7fffffff;
@@ -566,6 +567,23 @@
}
/**
+ * soup_date_to_timeval:
+ * @date: a #SoupDate
+ * @time: a #GTimeVal structure in which to store the converted time.
+ *
+ * Converts @date to a #GTimeVal.
+ */
+void
+soup_date_to_timeval (SoupDate *date, GTimeVal *time)
+{
+ /* FIXME: offset, etc */
+
+ time->tv_sec = rata_die_day (date) - TIME_T_EPOCH_RATA_DIE_DAY;
+ time->tv_sec = ((((time->tv_sec * 24) + date->hour) * 60) + date->minute) * 60 + date->second;
+ time->tv_usec = 0;
+}
+
+/**
* soup_date_is_past:
* @date: a #SoupDate
*
Modified: trunk/libsoup/soup-date.h
==============================================================================
--- trunk/libsoup/soup-date.h (original)
+++ trunk/libsoup/soup-date.h Fri Aug 22 14:13:56 2008
@@ -51,6 +51,8 @@
char *soup_date_to_string (SoupDate *date,
SoupDateFormat format);
time_t soup_date_to_time_t (SoupDate *date);
+void soup_date_to_timeval (SoupDate *date,
+ GTimeVal *time);
gboolean soup_date_is_past (SoupDate *date);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]