summaryrefslogtreecommitdiff
path: root/gdata/exif
diff options
context:
space:
mode:
authorPhilip Withnall <philip@tecnocode.co.uk>2010-10-04 00:18:22 +0100
committerPhilip Withnall <philip@tecnocode.co.uk>2010-10-04 10:30:17 +0100
commita6762e29ab0ffb275e907fe927c7fe96e3b1dfc8 (patch)
tree2b30eb2aaa547e31b2f8f2b1fc3c27fc964a455f /gdata/exif
parentfc13dc995e8afc12e154f384554cbf613da76e48 (diff)
downloadlibgdata-a6762e29ab0ffb275e907fe927c7fe96e3b1dfc8.tar.gz
core: Use gint64 timestamps instead of GTimeVals
This means we no longer have to register GTimeVal with the GType system, and everything is generally neater because we never used GTimeVal's microsecond precision anyway.
Diffstat (limited to 'gdata/exif')
-rw-r--r--gdata/exif/gdata-exif-tags.c22
-rw-r--r--gdata/exif/gdata-exif-tags.h2
2 files changed, 12 insertions, 12 deletions
diff --git a/gdata/exif/gdata-exif-tags.c b/gdata/exif/gdata-exif-tags.c
index 177b3d21..cd7bf45d 100644
--- a/gdata/exif/gdata-exif-tags.c
+++ b/gdata/exif/gdata-exif-tags.c
@@ -62,7 +62,7 @@ struct _GDataExifTagsPrivate {
gint iso;
gchar *make;
gchar *model;
- GTimeVal _time;
+ gint64 _time; /* in milliseconds! */
};
G_DEFINE_TYPE (GDataExifTags, gdata_exif_tags, GDATA_TYPE_PARSABLE)
@@ -87,6 +87,7 @@ static void
gdata_exif_tags_init (GDataExifTags *self)
{
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_EXIF_TAGS, GDataExifTagsPrivate);
+ self->priv->_time = -1;
}
static void
@@ -156,8 +157,7 @@ parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_da
milliseconds = g_ascii_strtoull ((gchar*) time_str, NULL, 10);
xmlFree (time_str);
- self->priv->_time.tv_sec = (glong) (milliseconds / 1000);
- self->priv->_time.tv_usec = (glong) ((milliseconds % 1000) * 1000);
+ self->priv->_time = (gint64) milliseconds;
} else {
return GDATA_PARSABLE_CLASS (gdata_exif_tags_parent_class)->parse_xml (parsable, doc, node, user_data, error);
}
@@ -327,17 +327,17 @@ gdata_exif_tags_get_model (GDataExifTags *self)
/**
* gdata_exif_tags_get_time:
* @self: a #GDataExifTags
- * @_time: (out caller-allocates): a #GTimeVal
*
- * Gets the #GDataExifTags:time property and puts it in @_time. If the property is unset,
- * both fields in the #GTimeVal will be set to <code class="literal">0</code>.
+ * Gets the #GDataExifTags:time property as a number of milliseconds since the epoch. If the property is unset, <code class="literal">-1</code> will
+ * be returned.
+ *
+ * Return value: the UNIX timestamp for the time property in milliseconds, or <code class="literal">-1</code>
*
* Since: 0.5.0
**/
-void
-gdata_exif_tags_get_time (GDataExifTags *self, GTimeVal *_time)
+gint64
+gdata_exif_tags_get_time (GDataExifTags *self)
{
- g_return_if_fail (GDATA_IS_EXIF_TAGS (self));
- g_return_if_fail (_time != NULL);
- *_time = self->priv->_time;
+ g_return_val_if_fail (GDATA_IS_EXIF_TAGS (self), -1);
+ return self->priv->_time;
}
diff --git a/gdata/exif/gdata-exif-tags.h b/gdata/exif/gdata-exif-tags.h
index c64eac5b..2dcb76e9 100644
--- a/gdata/exif/gdata-exif-tags.h
+++ b/gdata/exif/gdata-exif-tags.h
@@ -71,7 +71,7 @@ const gchar *gdata_exif_tags_get_image_unique_id (GDataExifTags *self) G_GNUC_PU
gint gdata_exif_tags_get_iso (GDataExifTags *self) G_GNUC_PURE;
const gchar *gdata_exif_tags_get_make (GDataExifTags *self) G_GNUC_PURE;
const gchar *gdata_exif_tags_get_model (GDataExifTags *self) G_GNUC_PURE;
-void gdata_exif_tags_get_time (GDataExifTags *self, GTimeVal *time);
+gint64 gdata_exif_tags_get_time (GDataExifTags *self);
G_END_DECLS