Use local time rather than Greenwich Mean Time

2001-01-25  Bradford Hovinen  <hovinen@ximian.com>

	* config-log.c (get_current_date): Use local time rather than
	Greenwich Mean Time

	* location.c (location_store_xml): Implement; copy from
	location_store
	(location_store): Free filename after use

	* archive.c (archive_load): Free prefix only if not global

	* location.c (location_rollback_all_to): Increment array

	* util.c (parse_date): Normalize values
This commit is contained in:
Bradford Hovinen 2001-01-25 19:44:54 +00:00 committed by Bradford Hovinen (Gdict maintainer)
parent c861fe5a55
commit b3559fa5ac
6 changed files with 58 additions and 3 deletions

View file

@ -1,6 +1,15 @@
2001-01-25 Bradford Hovinen <hovinen@ximian.com>
* location.c (location_rollback_all_to): Increment array index
* config-log.c (get_current_date): Use local time rather than
Greenwich Mean Time
* location.c (location_store_xml): Implement; copy from
location_store
(location_store): Free filename after use
* archive.c (archive_load): Free prefix only if not global
* location.c (location_rollback_all_to): Increment array
* util.c (parse_date): Normalize values

View file

@ -4,6 +4,8 @@
* Support multiple backends from CLI
* Add translateable backend description support
* Some way to store the rollback time for each backend, for GUI purposes
* Have defaults stored somewhere, to be restored when the user goes
back before the first configuration edit
Long-term
* Add clustering support:

View file

@ -196,7 +196,7 @@ archive_load (gboolean is_global)
"prefix", prefix,
NULL);
if (is_global)
if (!is_global)
g_free (prefix);
if (do_load (ARCHIVE (object)) == FALSE) {

View file

@ -851,7 +851,7 @@ get_current_date (void)
struct tm *time_1, *ret;
current_time = time (NULL);
time_1 = gmtime (&current_time);
time_1 = localtime (&current_time);
ret = g_new (struct tm, 1);
memcpy (ret, time_1, sizeof (struct tm));
return ret;

View file

@ -434,6 +434,7 @@ location_store (Location *location, gchar *backend_id, FILE *input)
filename = g_strdup_printf ("%s/%08x.xml",
location->p->fullpath, id);
output = fopen (filename, "w");
g_free (filename);
if (output == NULL) return;
@ -445,6 +446,45 @@ location_store (Location *location, gchar *backend_id, FILE *input)
fclose (output);
}
/**
* location_store_xml:
* @location:
* @backend_id:
* @input:
*
* Store configuration data from the given XML document object in the location
* under the given backend id
**/
void
location_store_xml (Location *location, gchar *backend_id, xmlDocPtr xml_doc)
{
gint id;
char *filename;
g_return_if_fail (location != NULL);
g_return_if_fail (IS_LOCATION (location));
g_return_if_fail (location->p->config_log != NULL);
g_return_if_fail (IS_CONFIG_LOG (location->p->config_log));
if (!location_contains (location, backend_id)) {
if (!location->p->inherits_location)
g_warning ("Could not find a location in the " \
"tree ancestry that stores this " \
"backend.");
else
location_store_xml (location->p->inherits_location,
backend_id, xml_doc);
}
id = config_log_write_entry (location->p->config_log, backend_id);
filename = g_strdup_printf ("%s/%08x.xml",
location->p->fullpath, id);
xmlSaveFile (filename, xml_doc);
g_free (filename);
}
/**
* location_rollback_backend_to:
* @location:

View file

@ -25,6 +25,7 @@
#define __LOCATION_H
#include <gnome.h>
#include <tree.h>
#include "config-log.h"
@ -64,6 +65,9 @@ void location_delete (Location *location);
void location_store (Location *location,
gchar *backend_id,
FILE *input);
void location_store_xml (Location *location,
gchar *backend_id,
xmlDocPtr xml_doc);
void location_rollback_backend_to (Location *location,
struct tm *date,