Only query the current time once when populating the history
This commit is contained in:
parent
297d38e7d0
commit
ae1ea1214b
1 changed files with 3 additions and 2 deletions
|
@ -180,6 +180,7 @@ midori_history_read_from_db (MidoriHistory* history,
|
||||||
sqlite3_stmt* statement;
|
sqlite3_stmt* statement;
|
||||||
gint result;
|
gint result;
|
||||||
gchar* sqlcmd;
|
gchar* sqlcmd;
|
||||||
|
time_t current_time;
|
||||||
|
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
GtkTreeIter root_iter;
|
GtkTreeIter root_iter;
|
||||||
|
@ -201,6 +202,8 @@ midori_history_read_from_db (MidoriHistory* history,
|
||||||
}
|
}
|
||||||
g_free (sqlcmd);
|
g_free (sqlcmd);
|
||||||
|
|
||||||
|
current_time = time (NULL);
|
||||||
|
|
||||||
while ((result = sqlite3_step (statement)) == SQLITE_ROW)
|
while ((result = sqlite3_step (statement)) == SQLITE_ROW)
|
||||||
{
|
{
|
||||||
KatzeItem* item;
|
KatzeItem* item;
|
||||||
|
@ -211,7 +214,6 @@ midori_history_read_from_db (MidoriHistory* history,
|
||||||
|
|
||||||
if (req_day == 0)
|
if (req_day == 0)
|
||||||
{
|
{
|
||||||
time_t current_time;
|
|
||||||
gint age;
|
gint age;
|
||||||
gchar token[50];
|
gchar token[50];
|
||||||
gchar* sdate;
|
gchar* sdate;
|
||||||
|
@ -221,7 +223,6 @@ midori_history_read_from_db (MidoriHistory* history,
|
||||||
|
|
||||||
item = katze_item_new ();
|
item = katze_item_new ();
|
||||||
katze_item_set_added (item, day);
|
katze_item_set_added (item, day);
|
||||||
current_time = time (NULL);
|
|
||||||
age = sokoke_days_between ((time_t*)&date, ¤t_time);
|
age = sokoke_days_between ((time_t*)&date, ¤t_time);
|
||||||
|
|
||||||
/* A negative age is a date in the future, the clock is probably off */
|
/* A negative age is a date in the future, the clock is probably off */
|
||||||
|
|
Loading…
Reference in a new issue