char *logfile;
int ret;
unsigned int cnt;
+ unsigned long long skew_offset;
+ unsigned long long skew_variance;
+ long long clock_offset;
struct GNUNET_CONFIGURATION_Handle *cfg;
struct GNUNET_GETOPT_CommandLineOption defoptions[] = {
GNUNET_GETOPT_OPTION_CFG_FILE (&cc.cfgfile),
}
GNUNET_free (allopts);
GNUNET_free (lpfx);
-
+ if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number(cc.cfg, "testing", "skew_offset", &skew_offset) &&
+ (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number(cc.cfg, "testing", "skew_variance", &skew_variance)))
+ {
+ clock_offset = skew_offset - skew_variance;
+ }
/* run */
cc.args = &argv[ret];
GNUNET_SCHEDULER_run (&program_main, &cc);
* @param timeout new timeout for activities on the socket
*/
void
-GNUNET_SERVER_client_set_timeout (struct GNUNET_SERVER_Client *client,
- struct GNUNET_TIME_Relative timeout)
+GNUNET_SERVER_client_set_timeout(struct GNUNET_SERVER_Client *client,
+ struct GNUNET_TIME_Relative timeout)
{
client->idle_timeout = timeout;
}
char *logfile;
int do_daemonize;
unsigned int i;
+ unsigned long long skew_offset;
+ unsigned long long skew_variance;
+ long long clock_offset;
struct GNUNET_SERVICE_Context sctx;
struct GNUNET_CONFIGURATION_Handle *cfg;
struct GNUNET_GETOPT_CommandLineOption service_options[] = {
"Service `%s' runs with configuration from `%s'\n",
serviceName, cfg_fn);
#endif
+ if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number(sctx.cfg, "testing", "skew_offset", &skew_offset) &&
+ (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number(sctx.cfg, "testing", "skew_variance", &skew_variance)))
+ {
+ clock_offset = skew_offset - skew_variance;
+#if 1
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Skewing clock by %ll\n", clock_offset);
+#endif
+ }
/* actually run service */
GNUNET_SCHEDULER_run (&service_task, &sctx);
#include "platform.h"
#include "gnunet_time_lib.h"
+static long long timestamp_offset;
+
+/**
+ * Set the timestamp offset for this instance.
+ *
+ * @param offset the offset to skew the locale time by
+ */
+void
+GNUNET_TIME_set_offset(long long offset)
+{
+ timestamp_offset = offset;
+}
/**
* Get the current time (works just as "time", just that we use the
GETTIMEOFDAY (&tv, NULL);
ret.abs_value =
(uint64_t) (((uint64_t) tv.tv_sec * 1000LL) +
- ((uint64_t) tv.tv_usec / 1000LL));
+ ((uint64_t) tv.tv_usec / 1000LL)) + timestamp_offset;
return ret;
}