aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-09-27 19:36:14 +0000
committerChristian Grothoff <christian@grothoff.org>2012-09-27 19:36:14 +0000
commit9cefd9c5522797b132749ca7d99a930007d28347 (patch)
tree63aa5de219bbd5f0d23f5f0affd418eee5bdd494 /src/util
parenta6a4bf9797ecf078179a102f52d1e30a4987bf03 (diff)
downloadgnunet-9cefd9c5522797b132749ca7d99a930007d28347.tar.gz
gnunet-9cefd9c5522797b132749ca7d99a930007d28347.zip
-converting more places to use STRINGS_relative_time_to_string
Diffstat (limited to 'src/util')
-rw-r--r--src/util/bandwidth.c7
-rw-r--r--src/util/client.c13
-rw-r--r--src/util/scheduler.c8
-rw-r--r--src/util/server.c6
-rw-r--r--src/util/test_crypto_ksk.c13
-rw-r--r--src/util/test_crypto_rsa.c19
6 files changed, 31 insertions, 35 deletions
diff --git a/src/util/bandwidth.c b/src/util/bandwidth.c
index 9d679493a..60cb50529 100644
--- a/src/util/bandwidth.c
+++ b/src/util/bandwidth.c
@@ -24,8 +24,7 @@
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 */ 25 */
26#include "platform.h" 26#include "platform.h"
27#include "gnunet_bandwidth_lib.h" 27#include "gnunet_util_lib.h"
28#include "gnunet_server_lib.h"
29 28
30 29
31#define LOG(kind,...) GNUNET_log_from (kind, "util-bandwidth", __VA_ARGS__) 30#define LOG(kind,...) GNUNET_log_from (kind, "util-bandwidth", __VA_ARGS__)
@@ -83,9 +82,9 @@ GNUNET_BANDWIDTH_value_get_available_until (struct GNUNET_BANDWIDTH_Value32NBO
83 82
84 b = ntohl (bps.value__); 83 b = ntohl (bps.value__);
85 LOG (GNUNET_ERROR_TYPE_DEBUG, 84 LOG (GNUNET_ERROR_TYPE_DEBUG,
86 "Bandwidth has %llu bytes available until deadline in %llums\n", 85 "Bandwidth has %llu bytes available until deadline in %s\n",
87 (unsigned long long) ((b * deadline.rel_value + 500LL) / 1000LL), 86 (unsigned long long) ((b * deadline.rel_value + 500LL) / 1000LL),
88 deadline.rel_value); 87 GNUNET_STRINGS_relative_time_to_string (deadline, GNUNET_YES));
89 return (b * deadline.rel_value + 500LL) / 1000LL; 88 return (b * deadline.rel_value + 500LL) / 1000LL;
90} 89}
91 90
diff --git a/src/util/client.c b/src/util/client.c
index 73cca2383..337eade0c 100644
--- a/src/util/client.c
+++ b/src/util/client.c
@@ -27,11 +27,8 @@
27 * connections between clients and service providers. 27 * connections between clients and service providers.
28 */ 28 */
29#include "platform.h" 29#include "platform.h"
30#include "gnunet_common.h"
31#include "gnunet_client_lib.h"
32#include "gnunet_protocols.h" 30#include "gnunet_protocols.h"
33#include "gnunet_server_lib.h" 31#include "gnunet_util_lib.h"
34#include "gnunet_scheduler_lib.h"
35 32
36 33
37/** 34/**
@@ -955,9 +952,9 @@ client_delayed_retry (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
955 (th->client->back_off, 2), 952 (th->client->back_off, 2),
956 GNUNET_TIME_UNIT_SECONDS); 953 GNUNET_TIME_UNIT_SECONDS);
957 LOG (GNUNET_ERROR_TYPE_DEBUG, 954 LOG (GNUNET_ERROR_TYPE_DEBUG,
958 "Transmission failed %u times, trying again in %llums.\n", 955 "Transmission failed %u times, trying again in %s.\n",
959 MAX_ATTEMPTS - th->attempts_left, 956 MAX_ATTEMPTS - th->attempts_left,
960 (unsigned long long) delay.rel_value); 957 GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES));
961 th->reconnect_task = 958 th->reconnect_task =
962 GNUNET_SCHEDULER_add_delayed (delay, &client_delayed_retry, th); 959 GNUNET_SCHEDULER_add_delayed (delay, &client_delayed_retry, th);
963 return; 960 return;
@@ -1028,9 +1025,9 @@ client_notify (void *cls, size_t size, void *buf)
1028 (client->back_off, 2), 1025 (client->back_off, 2),
1029 GNUNET_TIME_UNIT_SECONDS); 1026 GNUNET_TIME_UNIT_SECONDS);
1030 LOG (GNUNET_ERROR_TYPE_DEBUG, 1027 LOG (GNUNET_ERROR_TYPE_DEBUG,
1031 "Transmission failed %u times, trying again in %llums.\n", 1028 "Transmission failed %u times, trying again in %s.\n",
1032 MAX_ATTEMPTS - th->attempts_left, 1029 MAX_ATTEMPTS - th->attempts_left,
1033 (unsigned long long) delay.rel_value); 1030 GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES));
1034 client->th = th; 1031 client->th = th;
1035 th->reconnect_task = 1032 th->reconnect_task =
1036 GNUNET_SCHEDULER_add_delayed (delay, &client_delayed_retry, th); 1033 GNUNET_SCHEDULER_add_delayed (delay, &client_delayed_retry, th);
diff --git a/src/util/scheduler.c b/src/util/scheduler.c
index abf351701..6231a1987 100644
--- a/src/util/scheduler.c
+++ b/src/util/scheduler.c
@@ -577,10 +577,10 @@ run_ready (struct GNUNET_NETWORK_FDSet *rs, struct GNUNET_NETWORK_FDSet *ws)
577 if (GNUNET_TIME_absolute_get_duration (pos->start_time).rel_value > 577 if (GNUNET_TIME_absolute_get_duration (pos->start_time).rel_value >
578 DELAY_THRESHOLD.rel_value) 578 DELAY_THRESHOLD.rel_value)
579 { 579 {
580 LOG (GNUNET_ERROR_TYPE_ERROR, "Task %llu took %llums to be scheduled\n", 580 LOG (GNUNET_ERROR_TYPE_DEBUG,
581 pos->id, 581 "Task %llu took %s to be scheduled\n",
582 (unsigned long long) 582 (unsigned long long) pos->id,
583 GNUNET_TIME_absolute_get_duration (pos->start_time).rel_value); 583 GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (pos->start_time), GNUNET_YES));
584 } 584 }
585#endif 585#endif
586 tc.reason = pos->reason; 586 tc.reason = pos->reason;
diff --git a/src/util/server.c b/src/util/server.c
index 663661fea..7ecb98c64 100644
--- a/src/util/server.c
+++ b/src/util/server.c
@@ -832,11 +832,9 @@ warn_no_receive_done (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
832 &warn_no_receive_done, client); 832 &warn_no_receive_done, client);
833 if (0 == (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) 833 if (0 == (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
834 LOG (GNUNET_ERROR_TYPE_WARNING, 834 LOG (GNUNET_ERROR_TYPE_WARNING,
835 _ 835 _("Processing code for message of type %u did not call `GNUNET_SERVER_receive_done' after %s\n"),
836 ("Processing code for message of type %u did not call GNUNET_SERVER_receive_done after %llums\n"),
837 (unsigned int) client->warn_type, 836 (unsigned int) client->warn_type,
838 (unsigned long long) 837 GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (client->warn_start), GNUNET_YES));
839 GNUNET_TIME_absolute_get_duration (client->warn_start).rel_value);
840} 838}
841 839
842 840
diff --git a/src/util/test_crypto_ksk.c b/src/util/test_crypto_ksk.c
index f0e4337ef..40bf435ef 100644
--- a/src/util/test_crypto_ksk.c
+++ b/src/util/test_crypto_ksk.c
@@ -167,9 +167,10 @@ testEncryptDecrypt (struct GNUNET_CRYPTO_RsaPrivateKey *hostkey)
167 continue; 167 continue;
168 } 168 }
169 } 169 }
170 printf ("%d RSA encrypt/decrypt operations %llums (%d failures)\n", ITER, 170 printf ("%d RSA encrypt/decrypt operations %s (%d failures)\n",
171 (unsigned long long) 171 ITER,
172 GNUNET_TIME_absolute_get_duration (start).rel_value, ok); 172 GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (start), GNUNET_YES),
173 ok);
173 if (ok == 0) 174 if (ok == 0)
174 return GNUNET_OK; 175 return GNUNET_OK;
175 else 176 else
@@ -217,9 +218,9 @@ testSignVerify (struct GNUNET_CRYPTO_RsaPrivateKey *hostkey)
217 continue; 218 continue;
218 } 219 }
219 } 220 }
220 printf ("%d RSA sign/verify operations %llums\n", ITER, 221 printf ("%d RSA sign/verify operations %s\n",
221 (unsigned long long) 222 ITER,
222 GNUNET_TIME_absolute_get_duration (start).rel_value); 223 GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (start), GNUNET_YES));
223 return ok; 224 return ok;
224} 225}
225 226
diff --git a/src/util/test_crypto_rsa.c b/src/util/test_crypto_rsa.c
index 0113b7ad0..fcaf78612 100644
--- a/src/util/test_crypto_rsa.c
+++ b/src/util/test_crypto_rsa.c
@@ -81,9 +81,10 @@ testEncryptDecrypt ()
81 continue; 81 continue;
82 } 82 }
83 } 83 }
84 printf ("%d RSA encrypt/decrypt operations %llums (%d failures)\n", ITER, 84 printf ("%d RSA encrypt/decrypt operations %s (%d failures)\n",
85 (unsigned long long) 85 ITER,
86 GNUNET_TIME_absolute_get_duration (start).rel_value, ok); 86 GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (start), GNUNET_YES),
87 ok);
87 if (ok == 0) 88 if (ok == 0)
88 return GNUNET_OK; 89 return GNUNET_OK;
89 return GNUNET_SYSERR; 90 return GNUNET_SYSERR;
@@ -169,9 +170,10 @@ testEncryptDecryptSK ()
169 continue; 170 continue;
170 } 171 }
171 } 172 }
172 printf ("%d RSA encrypt/decrypt SK operations %llums (%d failures)\n", ITER, 173 printf ("%d RSA encrypt/decrypt SK operations %s (%d failures)\n",
173 (unsigned long long) 174 ITER,
174 GNUNET_TIME_absolute_get_duration (start).rel_value, ok); 175 GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (start), GNUNET_YES),
176 ok);
175 if (ok != 0) 177 if (ok != 0)
176 return GNUNET_SYSERR; 178 return GNUNET_SYSERR;
177 return GNUNET_OK; 179 return GNUNET_OK;
@@ -220,9 +222,8 @@ testSignVerify ()
220 continue; 222 continue;
221 } 223 }
222 } 224 }
223 printf ("%d RSA sign/verify operations %llums\n", ITER, 225 printf ("%d RSA sign/verify operations %s\n", ITER,
224 (unsigned long long) 226 GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (start), GNUNET_YES));
225 GNUNET_TIME_absolute_get_duration (start).rel_value);
226 return ok; 227 return ok;
227} 228}
228 229