Re: Time synchronisation
- From: Robert Mibus <mibus bigpond com>
- To: gnome-pilot-list gnome org
- Subject: Re: Time synchronisation
- Date: Wed, 20 Jun 2001 10:21:58 +0930
On Mon, Jun 18, 2001 at 02:27:11PM -0400, JP Rosevear wrote:
> On 16 Jun 2001 15:54:23 +0930, Robert Mibus wrote:
> > The attached patches (one for 0.1.54 and one for CVS) allow copying the
> > local PCs time to the computer. As mentioned waaay back, it can be
> > dangerous on some pilots, so it's a config option:
Attached *now* :-D
Unfortunately, I lost the one against CVS but the only part that gets
rejected is an #include for time.h in gpilotd.c.
> Is this done as a conduit?
No, there is a call to dlp_SetSysDateTime() in do_sync() (gpilotd.c).
thanks people;
> -JP
mibus
--
Robert Mibus <mibus bigpond com>
Its a bug! its a typo in the code! no! its Windows!
--- gpilotd.c.orig Mon Aug 7 10:32:18 2000
+++ gpilotd.c Sat Jun 16 12:50:42 2001
@@ -38,6 +38,7 @@
#include "manager.h"
#include <libgnome/libgnome.h>
#include <string.h>
+#include <time.h>
#include <gpilot-userinfo.h>
#include <gpilot-structures.h>
#include <unistd.h>
@@ -300,6 +301,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 */
--- manager.c.orig Sat Jun 16 12:43:47 2001
+++ manager.c Sat Jun 16 12:58:36 2001
@@ -560,6 +560,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,
--- manager.h.orig Sat Jun 16 12:47:54 2001
+++ manager.h Sat Jun 16 12:51:18 2001
@@ -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]