time sync



Here's a patch against CVS for syncing time - the same as my last but
for CVS.

eskil/whoever, is this OK or is a GUI needed? (It's an option in
~/.gnome/.../conduits%d, off by default)

If it's OK, can someone please commit it?

Thanks;
mibus


-- 
Robert Mibus <mibus bigpond com>
Heisengberg might have been here.
Index: gpilotd.c
===================================================================
RCS file: /cvs/gnome/gnome-pilot/gpilotd/gpilotd.c,v
retrieving revision 1.116
diff -u -r1.116 gpilotd.c
--- gpilotd.c	2001/06/14 02:35:33	1.116
+++ gpilotd.c	2001/07/05 03:05:59
@@ -37,6 +37,7 @@
 #include "manager.h"
 #include <libgnome/libgnome.h>
 #include <string.h>
+#include <time.h>
 #include "gnome-pilot-structures.h"
 #include <unistd.h>
 #include <signal.h>
@@ -472,6 +473,12 @@
 			gpilot_add_log_entry (pfd,_("On host %d\n"),stamp.sync_PC_Id);
 	}
 
+	if (gpilot_should_sync_time (pilot))
+	{
+		gpilot_add_log_entry(pfd,_("Copying local time to pilot...\n"));
+		dlp_SetSysDateTime (pfd, time(NULL));
+	}
+	
 	/* first, run the initial operations, such as single conduit runs,
 	   restores etc. If this returns True, continue with normal conduit running,
 	   if False, don't proceed */
Index: manager.c
===================================================================
RCS file: /cvs/gnome/gnome-pilot/gpilotd/manager.c,v
retrieving revision 1.67
diff -u -r1.67 manager.c
--- manager.c	2001/06/14 02:35:33	1.67
+++ manager.c	2001/07/05 03:06:03
@@ -588,6 +588,23 @@
 	gnome_pilot_conduit_management_destroy (manager);
 }
 
+int
+gpilot_should_sync_time (GPilotPilot *pilot)
+{
+	gchar *prefix;
+	int should=0;
+
+	if (!pilot)
+		return 0;
+
+	prefix = g_strdup_printf ("gnome-pilot.d/conduits%d/General/", pilot->pilot_id);
+        gnome_config_push_prefix(prefix);
+        should = gnome_config_get_bool_with_default ("should_sync_time", 0);
+        gnome_config_pop_prefix();
+        g_free(prefix);
+
+	return should;
+}
 
 void
 gpilot_load_conduits (GPilotContext *context,
Index: manager.h
===================================================================
RCS file: /cvs/gnome/gnome-pilot/gpilotd/manager.h,v
retrieving revision 1.24
diff -u -r1.24 manager.h
--- manager.h	2001/04/25 03:24:55	1.24
+++ manager.h	2001/07/05 03:06:04
@@ -91,6 +91,9 @@
 void gpilot_remove_first_sync_settings(guint32 pilot_id,
 				       gchar *config_name);
 
+/* Whether dlp_SetSysDateTime() should be run */
+int gpilot_should_sync_time (GPilotPilot *pilot);
+
 /* Given a context, a pilot, loads the conduits into three lists,
    The conduits, the backup conduits and the file install conduits.
    The latter two are typically only 1 element a list */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]