mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2026-04-04 22:30:39 +02:00
Return all history records for a timespan of zero
This makes the code conform to the documentation.
This commit is contained in:
parent
5b2211cb23
commit
e51ffd27de
1 changed files with 7 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue