summaryrefslogtreecommitdiff
path: root/src/up-history.c
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2012-01-18 14:49:20 +0000
committerRichard Hughes <richard@hughsie.com>2012-01-18 14:49:20 +0000
commite51ffd27de23bd6ba245c5df711c919efa35c5aa (patch)
tree1bdca9db0baa4ba4d952a306d73e74895528fbc6 /src/up-history.c
parent5b2211cb2362918568fd454453aeccb2551ee3d2 (diff)
downloadupower-e51ffd27de23bd6ba245c5df711c919efa35c5aa.tar.gz
Return all history records for a timespan of zero
This makes the code conform to the documentation.
Diffstat (limited to 'src/up-history.c')
-rw-r--r--src/up-history.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/up-history.c b/src/up-history.c
index 945db8f..08e101b 100644
--- a/src/up-history.c
+++ b/src/up-history.c
@@ -213,6 +213,12 @@ up_history_copy_array_timespan (const GPtrArray *array, guint timespan)
if (array->len == 0)
return NULL;
+ /* no limit on data */
+ if (timespan == 0) {
+ array_new = g_ptr_array_ref ((GPtrArray *) array);
+ goto out;
+ }
+
/* new data */
array_new = g_ptr_array_new ();
g_get_current_time (&timeval);
@@ -225,7 +231,7 @@ up_history_copy_array_timespan (const GPtrArray *array, guint timespan)
if (timeval.tv_sec - up_history_item_get_time (item) < timespan)
g_ptr_array_add (array_new, g_object_ref (item));
}
-
+out:
return array_new;
}