[libgis] Use time_t for times instead of strings
- From: Andy Spencer <andys src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgis] Use time_t for times instead of strings
- Date: Fri, 10 Sep 2010 03:16:03 +0000 (UTC)
commit 02d47fe228b984375a98b87d3c2b3b69f75e8b1e
Author: Andy Spencer <andy753421 gmail com>
Date: Mon Feb 15 18:46:30 2010 +0000
Use time_t for times instead of strings
src/gis-viewer.c | 17 +++++++----------
src/gis-viewer.h | 6 +++---
2 files changed, 10 insertions(+), 13 deletions(-)
---
diff --git a/src/gis-viewer.c b/src/gis-viewer.c
index b4e3d82..075c039 100644
--- a/src/gis-viewer.c
+++ b/src/gis-viewer.c
@@ -213,12 +213,11 @@ void gis_viewer_setup(GisViewer *viewer, GisPlugins *plugins, GisPrefs *prefs)
*
* Set the current time for the view
*/
-void gis_viewer_set_time(GisViewer *viewer, const char *time)
+void gis_viewer_set_time(GisViewer *viewer, time_t time)
{
g_assert(GIS_IS_VIEWER(viewer));
- g_debug("GisViewer: set_time - time=%s", time);
- g_free(viewer->time);
- viewer->time = g_strdup(time);
+ g_debug("GisViewer: set_time - time=%ld", time);
+ viewer->time = time;
_gis_viewer_emit_time_changed(viewer);
}
@@ -230,7 +229,7 @@ void gis_viewer_set_time(GisViewer *viewer, const char *time)
*
* Returns: the current time
*/
-gchar *gis_viewer_get_time(GisViewer *viewer)
+time_t gis_viewer_get_time(GisViewer *viewer)
{
g_assert(GIS_IS_VIEWER(viewer));
g_debug("GisViewer: get_time");
@@ -557,7 +556,6 @@ static void gis_viewer_init(GisViewer *viewer)
{
g_debug("GisViewer: init");
/* Default values */
- viewer->time = g_strdup("");
viewer->location[0] = 40;
viewer->location[1] = -100;
viewer->location[2] = 1.5*EARTH_R;
@@ -588,7 +586,6 @@ static void gis_viewer_finalize(GObject *gobject)
{
g_debug("GisViewer: finalize");
GisViewer *viewer = GIS_VIEWER(gobject);
- g_free(viewer->time);
G_OBJECT_CLASS(gis_viewer_parent_class)->finalize(gobject);
}
static void gis_viewer_class_init(GisViewerClass *klass)
@@ -600,7 +597,7 @@ static void gis_viewer_class_init(GisViewerClass *klass)
/**
* GisViewer::time-changed:
* @viewer: the viewer.
- * @time: a string representation of the time.
+ * @time: the new time.
*
* The ::time-changed signal is emitted when the viewers current time
* changers.
@@ -612,10 +609,10 @@ static void gis_viewer_class_init(GisViewerClass *klass)
0,
NULL,
NULL,
- g_cclosure_marshal_VOID__STRING,
+ g_cclosure_marshal_VOID__LONG,
G_TYPE_NONE,
1,
- G_TYPE_STRING);
+ G_TYPE_LONG);
/**
* GisViewer::location-changed:
diff --git a/src/gis-viewer.h b/src/gis-viewer.h
index b85120b..76a2d11 100644
--- a/src/gis-viewer.h
+++ b/src/gis-viewer.h
@@ -89,7 +89,7 @@ struct _GisViewer {
/* instance members */
GisPlugins *plugins;
GisPrefs *prefs;
- gchar *time;
+ time_t time;
gdouble location[3];
gdouble rotation[3];
gboolean offline;
@@ -125,8 +125,8 @@ GType gis_viewer_get_type(void);
/* Methods */
void gis_viewer_setup(GisViewer *viewer, GisPlugins *plugins, GisPrefs *prefs);
-void gis_viewer_set_time(GisViewer *viewer, const gchar *time);
-gchar *gis_viewer_get_time(GisViewer *viewer);
+void gis_viewer_set_time(GisViewer *viewer, time_t time);
+time_t gis_viewer_get_time(GisViewer *viewer);
void gis_viewer_set_location(GisViewer *viewer, gdouble lat, gdouble lon, gdouble elev);
void gis_viewer_get_location(GisViewer *viewer, gdouble *lat, gdouble *lon, gdouble *elev);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]