[Openvas-commits] r12150 - in trunk/openvas-manager: . src
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Mon Nov 21 19:40:14 CET 2011
Author: mattm
Date: 2011-11-21 19:40:12 +0100 (Mon, 21 Nov 2011)
New Revision: 12150
Modified:
trunk/openvas-manager/ChangeLog
trunk/openvas-manager/src/manage.h
trunk/openvas-manager/src/manage_sql.c
trunk/openvas-manager/src/omp.c
Log:
* src/manage_sql.c (iso_time): Make public.
* src/manage.h: Update header accordingly.
* src/omp.c (ctime_strip_newline): Remove. Out of use.
(buffer_notes_xml, buffer_overrides_xml, buffer_overrides_xml)
(buffer_schedules_xml, buffer_schedules_xml, omp_xml_handle_end_element)
(omp_xml_handle_end_element, omp_xml_handle_end_element)
(omp_xml_handle_end_element): Send ISO times instead of ctime.
Modified: trunk/openvas-manager/ChangeLog
===================================================================
--- trunk/openvas-manager/ChangeLog 2011-11-21 16:29:29 UTC (rev 12149)
+++ trunk/openvas-manager/ChangeLog 2011-11-21 18:40:12 UTC (rev 12150)
@@ -1,5 +1,17 @@
2011-11-21 Matthew Mundell <matthew.mundell at greenbone.net>
+ * src/manage_sql.c (iso_time): Make public.
+
+ * src/manage.h: Update header accordingly.
+
+ * src/omp.c (ctime_strip_newline): Remove. Out of use.
+ (buffer_notes_xml, buffer_overrides_xml, buffer_overrides_xml)
+ (buffer_schedules_xml, buffer_schedules_xml, omp_xml_handle_end_element)
+ (omp_xml_handle_end_element, omp_xml_handle_end_element)
+ (omp_xml_handle_end_element): Send ISO times instead of ctime.
+
+2011-11-21 Matthew Mundell <matthew.mundell at greenbone.net>
+
* src/manage_sql.c (parse_ctime): Parse ctime using the current timezone.
(parse_iso_time): Call parse_ctime instead of parse_iso_time, so that old
reports are imported using the current timezone.
Modified: trunk/openvas-manager/src/manage.h
===================================================================
--- trunk/openvas-manager/src/manage.h 2011-11-21 16:29:29 UTC (rev 12149)
+++ trunk/openvas-manager/src/manage.h 2011-11-21 18:40:12 UTC (rev 12150)
@@ -2005,4 +2005,10 @@
int
manage_set_setting (const gchar *, const gchar *);
+
+/* Helpers. */
+
+char *
+iso_time (time_t *);
+
#endif /* not OPENVAS_MANAGER_MANAGE_H */
Modified: trunk/openvas-manager/src/manage_sql.c
===================================================================
--- trunk/openvas-manager/src/manage_sql.c 2011-11-21 16:29:29 UTC (rev 12149)
+++ trunk/openvas-manager/src/manage_sql.c 2011-11-21 18:40:12 UTC (rev 12150)
@@ -251,9 +251,6 @@
static gchar*
clean_hosts (const char *);
-static char *
-iso_time (time_t *);
-
/* Variables. */
@@ -1376,7 +1373,7 @@
*
* @return Pointer to ISO time in static memory, or NULL on error.
*/
-static char *
+char *
iso_time (time_t *epoch_time)
{
struct tm *tm;
Modified: trunk/openvas-manager/src/omp.c
===================================================================
--- trunk/openvas-manager/src/omp.c 2011-11-21 16:29:29 UTC (rev 12149)
+++ trunk/openvas-manager/src/omp.c 2011-11-21 18:40:12 UTC (rev 12150)
@@ -237,22 +237,6 @@
}
/**
- * @brief Return string from ctime with newline replaces with terminator.
- *
- * @param[in] time Time.
- *
- * @return Return from ctime applied to time, with newline stripped off.
- */
-static char*
-ctime_strip_newline (time_t *time)
-{
- char* ret = ctime (time);
- if (ret && strlen (ret) > 0)
- ret[strlen (ret) - 1] = '\0';
- return ret;
-}
-
-/**
* @brief Return time defined by broken down time strings.
*
* If any argument is NULL, use the value from the current time.
@@ -8183,9 +8167,9 @@
}
creation_time = note_iterator_creation_time (notes);
- creation = g_strdup (ctime_strip_newline (&creation_time));
+ creation = g_strdup (iso_time (&creation_time));
mod_time = note_iterator_modification_time (notes);
- mod = g_strdup (ctime_strip_newline (&mod_time));
+ mod = g_strdup (iso_time (&mod_time));
buffer_xml_append_printf
(buffer,
@@ -8333,9 +8317,9 @@
}
creation_time = override_iterator_creation_time (overrides);
- creation = g_strdup (ctime_strip_newline (&creation_time));
+ creation = g_strdup (iso_time (&creation_time));
mod_time = override_iterator_modification_time (overrides);
- mod = g_strdup (ctime_strip_newline (&mod_time));
+ mod = g_strdup (iso_time (&mod_time));
end_time = override_iterator_end_time (overrides);
buffer_xml_append_printf
@@ -8359,7 +8343,7 @@
creation,
mod,
override_iterator_active (overrides),
- end_time > 1 ? ctime_strip_newline (&end_time) : "",
+ end_time > 1 ? iso_time (&end_time) : "",
override_iterator_text (overrides),
override_iterator_hosts (overrides)
? override_iterator_hosts (overrides) : "",
@@ -8836,7 +8820,7 @@
iterator_t tasks;
time_t first_time = schedule_iterator_first_time (schedules);
time_t next_time = schedule_iterator_next_time (schedules);
- gchar *first_ctime = g_strdup (ctime_strip_newline (&first_time));
+ gchar *first_iso_time = g_strdup (iso_time (&first_time));
buffer_xml_append_printf
(buffer,
@@ -8852,14 +8836,14 @@
schedule_iterator_uuid (schedules),
schedule_iterator_name (schedules),
schedule_iterator_comment (schedules),
- first_ctime,
- (next_time == 0 ? "over" : ctime_strip_newline (&next_time)),
+ first_iso_time,
+ (next_time == 0 ? "over" : iso_time (&next_time)),
schedule_iterator_period (schedules),
schedule_iterator_period_months (schedules),
schedule_iterator_duration (schedules),
schedule_iterator_in_use (schedules));
- g_free (first_ctime);
+ g_free (first_iso_time);
buffer_xml_append_printf (buffer, "<tasks>");
init_schedule_task_iterator (&tasks,
@@ -10414,7 +10398,7 @@
("<trust>%s<time>%s</time></trust>"
"<active>%i</active>",
report_format_iterator_trust (&report_formats),
- ctime_strip_newline (&trust_time),
+ iso_time (&trust_time),
report_format_iterator_active (&report_formats));
SEND_TO_CLIENT_OR_FAIL ("</report_format>");
@@ -15586,7 +15570,7 @@
agent_iterator_name (&agents),
agent_iterator_comment (&agents),
agent_iterator_trust (&agents),
- ctime_strip_newline (&trust_time));
+ iso_time (&trust_time));
}
break;
}
@@ -17006,7 +16990,7 @@
task_schedule_name,
(next_time == 0
? "over"
- : ctime_strip_newline (&next_time)),
+ : iso_time (&next_time)),
first_report,
last_report,
second_last_report);
@@ -17475,7 +17459,7 @@
task_schedule_name,
(next_time == 0
? "over"
- : ctime_strip_newline (&next_time)),
+ : iso_time (&next_time)),
schedule_in_trash,
first_report,
last_report,
More information about the Openvas-commits
mailing list