memcpy (&aa[1], plugin_addr, plugin_addr_len);
aa->plugin = GNUNET_strdup (plugin_name);
aa->session_id = session_id;
- aa->mlp_information = NULL;
- aa->blocked_until = GNUNET_TIME_absolute_get_zero();
- aa->block_interval = GNUNET_TIME_relative_get_zero();
- aa->next = NULL;
- aa->prev = NULL;
return aa;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Resetting interval for peer `%s' address %p from %llu to 0\n", GNUNET_i2s (&aa->peer), aa, aa->block_interval);
- aa->blocked_until = GNUNET_TIME_absolute_get_zero();
- aa->block_interval = GNUNET_TIME_relative_get_zero();
+ aa->blocked_until = GNUNET_TIME_UNIT_ZERO_ABS;
+ aa->block_interval = GNUNET_TIME_UNIT_ZERO;
return GNUNET_OK;
}
ctx->lp_result = GNUNET_SYSERR;
ctx->mlp_result = GNUNET_SYSERR;
- ctx->lp_duration = GNUNET_TIME_relative_get_forever();
- ctx->mlp_duration = GNUNET_TIME_relative_get_forever();
+ ctx->lp_duration = GNUNET_TIME_UNIT_FOREVER_REL;
+ ctx->mlp_duration = GNUNET_TIME_UNIT_FOREVER_REL;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Solve LP problem\n");
#if WRITE_MLP
#endif
mlp->control_param_mlp.tm_lim = max_duration.rel_value;
- mlp->last_execution = GNUNET_TIME_absolute_get_forever();
+ mlp->last_execution = GNUNET_TIME_UNIT_FOREVER_ABS;
mlp->co_D = D;
mlp->co_R = R;
#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
-#define VALID GNUNET_TIME_absolute_get_forever ()
+#define VALID GNUNET_TIME_UNIT_FOREVER_ABS
static struct GNUNET_ATS_SchedulingHandle *ats;
GNUNET_CLIENT_notify_transmit_ready (client,
sizeof (struct GNUNET_MessageHeader) +
sizeof (struct GNUNET_PeerIdentity),
- GNUNET_TIME_relative_get_forever (),
+ GNUNET_TIME_UNIT_FOREVER_REL,
GNUNET_YES, &transmit_is_connected_request, cth);
GNUNET_assert (NULL != cth->th);
return cth;
request_context->th =
GNUNET_CLIENT_notify_transmit_ready (client,
sizeof (struct GNUNET_MessageHeader),
- GNUNET_TIME_relative_get_forever (),
+ GNUNET_TIME_UNIT_FOREVER_REL,
GNUNET_YES, &transmit_request, NULL);
GNUNET_CLIENT_receive (client, &receive_info, request_context,
- GNUNET_TIME_relative_get_forever ());
+ GNUNET_TIME_UNIT_FOREVER_REL);
return GNUNET_OK;
}
return GNUNET_BLOCK_EVALUATION_RESULT_INVALID;
}
- if (GNUNET_TIME_relative_get_zero ().rel_value ==
+ if (0 ==
GNUNET_TIME_absolute_get_remaining (GNUNET_TIME_absolute_ntoh
(rec->expiration_time)).rel_value)
{
{
send_message (&msg_ctx->dest, &msg_ctx->sender, NULL, msg_ctx->message,
msg_ctx->message_size, default_dv_priority, msg_ctx->uid,
- GNUNET_TIME_relative_get_forever ());
+ GNUNET_TIME_UNIT_FOREVER_REL);
GNUNET_free (msg_ctx->message);
GNUNET_free (msg_ctx);
}
send_message (destination, original_sender, NULL, packed_message,
packed_message_size, default_dv_priority,
ntohl (incoming->uid),
- GNUNET_TIME_relative_get_forever ());
+ GNUNET_TIME_UNIT_FOREVER_REL);
}
if (ret != GNUNET_SYSERR)
return GNUNET_OK;
sizeof (p2p_dv_MESSAGE_NeighborInfo));
pending_message->msg = (struct GNUNET_MessageHeader *) &pending_message[1];
pending_message->importance = default_dv_priority;
- pending_message->timeout = GNUNET_TIME_relative_get_forever ();
+ pending_message->timeout = GNUNET_TIME_UNIT_FOREVER_REL;
memcpy (&pending_message->recipient, &to->identity,
sizeof (struct GNUNET_PeerIdentity));
pending_message->msg_size = sizeof (p2p_dv_MESSAGE_NeighborInfo);
GNUNET_SCHEDULER_add_now (try_core_send, NULL);
/*if (core_transmit_handle == NULL)
- * core_transmit_handle = GNUNET_CORE_notify_transmit_ready(coreAPI, GNUNET_YES, default_dv_priority, GNUNET_TIME_relative_get_forever(), &to->identity, sizeof(p2p_dv_MESSAGE_NeighborInfo), &core_transmit_notify, NULL); */
+ * core_transmit_handle = GNUNET_CORE_notify_transmit_ready(coreAPI, GNUNET_YES, default_dv_priority, GNUNET_TIME_UNIT_FOREVER_REL, &to->identity, sizeof(p2p_dv_MESSAGE_NeighborInfo), &core_transmit_notify, NULL); */
}
sizeof (p2p_dv_MESSAGE_Disconnect));
pending_message->msg = (struct GNUNET_MessageHeader *) &pending_message[1];
pending_message->importance = default_dv_priority;
- pending_message->timeout = GNUNET_TIME_relative_get_forever ();
+ pending_message->timeout = GNUNET_TIME_UNIT_FOREVER_REL;
memcpy (&pending_message->recipient, ¬ify->identity,
sizeof (struct GNUNET_PeerIdentity));
pending_message->msg_size = sizeof (p2p_dv_MESSAGE_Disconnect);
GNUNET_SCHEDULER_add_now (try_core_send, NULL);
/*if (core_transmit_handle == NULL)
- * core_transmit_handle = GNUNET_CORE_notify_transmit_ready(coreAPI, GNUNET_YES, default_dv_priority, GNUNET_TIME_relative_get_forever(), ¬ify->identity, sizeof(p2p_dv_MESSAGE_Disconnect), &core_transmit_notify, NULL); */
+ * core_transmit_handle = GNUNET_CORE_notify_transmit_ready(coreAPI, GNUNET_YES, default_dv_priority, GNUNET_TIME_UNIT_FOREVER_REL, ¬ify->identity, sizeof(p2p_dv_MESSAGE_Disconnect), &core_transmit_notify, NULL); */
return GNUNET_YES;
}
GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
"GNS_AUTO_PSEU: Name %s not taken in NS! Adding\n", gph->new_name);
- new_pkey.expiration = GNUNET_TIME_absolute_get_forever ();
+ new_pkey.expiration = GNUNET_TIME_UNIT_FOREVER_ABS;
new_pkey.data_size = sizeof(struct GNUNET_CRYPTO_ShortHashCode);
new_pkey.data = &gph->new_zone;
new_pkey.record_type = GNUNET_GNS_RECORD_PKEY;
{
struct GNUNET_NAMESTORE_RecordData rd[rd_count];
unsigned int i;
- struct GNUNET_TIME_Absolute exp = GNUNET_TIME_absolute_get_forever();
+ struct GNUNET_TIME_Absolute exp = GNUNET_TIME_UNIT_FOREVER_ABS;
if (GNUNET_SYSERR == GNUNET_NAMESTORE_records_deserialize (rd_len,
rd_data,
char* ip = TEST_IP;
struct in_addr *web = GNUNET_malloc(sizeof(struct in_addr));
- rd.expiration = GNUNET_TIME_absolute_get_forever ();
+ rd.expiration = GNUNET_TIME_UNIT_FOREVER_ABS;
GNUNET_assert(1 == inet_pton (AF_INET, ip, web));
rd.data_size = sizeof(struct in_addr);
rd.data = web;
rd.record_type = GNUNET_DNSPARSER_TYPE_A;
- sig = GNUNET_NAMESTORE_create_signature(bob_key, GNUNET_TIME_absolute_get_forever(), TEST_RECORD_NAME,
+ sig = GNUNET_NAMESTORE_create_signature(bob_key, GNUNET_TIME_UNIT_FOREVER_ABS, TEST_RECORD_NAME,
&rd, 1);
rd_payload_length = GNUNET_NAMESTORE_records_get_size (1, &rd);
nrb = GNUNET_malloc(rd_payload_length + strlen(TEST_RECORD_NAME) + 1
GNUNET_CRYPTO_short_hash(&bob_pkey, sizeof(bob_pkey), &bob_hash);
struct GNUNET_NAMESTORE_RecordData rd;
- rd.expiration = GNUNET_TIME_absolute_get_forever ();
+ rd.expiration = GNUNET_TIME_UNIT_FOREVER_ABS;
rd.data_size = sizeof(struct GNUNET_CRYPTO_ShortHashCode);
rd.data = &bob_hash;
rd.record_type = GNUNET_GNS_RECORD_PKEY;
struct GNUNET_NAMESTORE_RecordData rd;
char* ip = TEST_IP;
struct in_addr *web = GNUNET_malloc(sizeof(struct in_addr));
- rd.expiration = GNUNET_TIME_absolute_get_forever ();
+ rd.expiration = GNUNET_TIME_UNIT_FOREVER_ABS;
GNUNET_assert(1 == inet_pton (AF_INET, ip, web));
rd.data_size = sizeof(struct in_addr);
rd.data = web;
struct GNUNET_CRYPTO_RsaSignature *sig;
struct GNUNET_NAMESTORE_RecordData rd;
- rd.expiration = GNUNET_TIME_absolute_get_forever ();
+ rd.expiration = GNUNET_TIME_UNIT_FOREVER_ABS;
rd.data_size = strlen(TEST_PSEU_ALICE)+1;
rd.data = TEST_PSEU_ALICE;
rd.record_type = GNUNET_GNS_RECORD_PSEU;
sig = GNUNET_NAMESTORE_create_signature(alice_key,
- GNUNET_TIME_absolute_get_forever(),
+ GNUNET_TIME_UNIT_FOREVER_ABS,
"+",
&rd, 1);
rd_payload_length = GNUNET_NAMESTORE_records_get_size (1, &rd);
char* ip = TEST_IP;
struct in_addr *web = GNUNET_malloc(sizeof(struct in_addr));
- rd.expiration = GNUNET_TIME_absolute_get_forever ();
+ rd.expiration = GNUNET_TIME_UNIT_FOREVER_ABS;
GNUNET_assert(1 == inet_pton (AF_INET, ip, web));
rd.data_size = sizeof(struct in_addr);
rd.data = web;
rd.record_type = GNUNET_DNSPARSER_TYPE_A;
sig = GNUNET_NAMESTORE_create_signature(alice_key,
- GNUNET_TIME_absolute_get_forever(),
+ GNUNET_TIME_UNIT_FOREVER_ABS,
TEST_RECORD_NAME,
&rd, 1);
rd_payload_length = GNUNET_NAMESTORE_records_get_size (1, &rd);
struct GNUNET_CRYPTO_RsaSignature *sig;
struct GNUNET_NAMESTORE_RecordData rd;
- rd.expiration = GNUNET_TIME_absolute_get_forever ();
+ rd.expiration = GNUNET_TIME_UNIT_FOREVER_ABS;
rd.data_size = sizeof(struct GNUNET_CRYPTO_ShortHashCode);
rd.data = &alice_hash;
rd.record_type = GNUNET_GNS_RECORD_PKEY;
sig = GNUNET_NAMESTORE_create_signature(bob_key,
- GNUNET_TIME_absolute_get_forever(),
+ GNUNET_TIME_UNIT_FOREVER_ABS,
TEST_AUTHORITY_ALICE,
&rd,
1);
GNUNET_CRYPTO_short_hash(&alice_pkey, sizeof(alice_pkey), &alice_hash);
struct GNUNET_NAMESTORE_RecordData rd;
- rd.expiration = GNUNET_TIME_absolute_get_forever ();
+ rd.expiration = GNUNET_TIME_UNIT_FOREVER_ABS;
rd.data_size = sizeof(struct GNUNET_CRYPTO_ShortHashCode);
rd.data = &bob_hash;
rd.record_type = GNUNET_GNS_RECORD_PKEY;
struct GNUNET_NAMESTORE_RecordData rd;
char* ip = TEST_IP;
struct in_addr *web = GNUNET_malloc(sizeof(struct in_addr));
- rd.expiration = GNUNET_TIME_absolute_get_forever ();
+ rd.expiration = GNUNET_TIME_UNIT_FOREVER_ABS;
GNUNET_assert(1 == inet_pton (AF_INET, ip, web));
GNUNET_CRYPTO_short_hash(&bob_pkey, sizeof(bob_pkey), &bob_hash);
rd.data = web;
rd.record_type = GNUNET_DNSPARSER_TYPE_A;
sig = GNUNET_NAMESTORE_create_signature(bob_key,
- GNUNET_TIME_absolute_get_forever(),
+ GNUNET_TIME_UNIT_FOREVER_ABS,
TEST_RECORD_NAME,
&rd, 1);
struct GNUNET_NAMESTORE_RecordData rd;
char* ip = TEST_IP;
struct in_addr *web = GNUNET_malloc(sizeof(struct in_addr));
- rd.expiration = GNUNET_TIME_absolute_get_forever ();
+ rd.expiration = GNUNET_TIME_UNIT_FOREVER_ABS;
GNUNET_assert(1 == inet_pton (AF_INET, ip, web));
GNUNET_CRYPTO_short_hash(&bob_pkey, sizeof(bob_pkey), &bob_hash);
/* put alice into bobs zone */
GNUNET_CRYPTO_short_hash(&alice_pkey, sizeof(alice_pkey), &alice_hash);
rd.data = &alice_hash;
- sig = GNUNET_NAMESTORE_create_signature(bob_key, GNUNET_TIME_absolute_get_forever(), TEST_AUTHORITY_ALICE,
+ sig = GNUNET_NAMESTORE_create_signature(bob_key, GNUNET_TIME_UNIT_FOREVER_ABS, TEST_AUTHORITY_ALICE,
&rd, 1);
GNUNET_NAMESTORE_record_put (namestore_handle,
&bob_pkey,
TEST_AUTHORITY_ALICE,
- GNUNET_TIME_absolute_get_forever(),
+ GNUNET_TIME_UNIT_FOREVER_ABS,
1,
&rd,
sig,
rd.data_size = sizeof(struct in_addr);
rd.data = web;
rd.record_type = GNUNET_DNSPARSER_TYPE_A;
- sig = GNUNET_NAMESTORE_create_signature(alice_key,GNUNET_TIME_absolute_get_forever(), TEST_RECORD_NAME,
+ sig = GNUNET_NAMESTORE_create_signature(alice_key,GNUNET_TIME_UNIT_FOREVER_ABS, TEST_RECORD_NAME,
&rd, 1);
GNUNET_NAMESTORE_record_put (namestore_handle,
&alice_pkey,
TEST_RECORD_NAME,
- GNUNET_TIME_absolute_get_forever(),
+ GNUNET_TIME_UNIT_FOREVER_ABS,
1,
&rd,
sig,
rd.record_type = GNUNET_GNS_RECORD_PSEU;
GNUNET_free(sig);
- sig = GNUNET_NAMESTORE_create_signature(alice_key,GNUNET_TIME_absolute_get_forever(), "",
+ sig = GNUNET_NAMESTORE_create_signature(alice_key,GNUNET_TIME_UNIT_FOREVER_ABS, "",
&rd, 1);
GNUNET_NAMESTORE_record_put (namestore_handle,
&alice_pkey,
"",
- GNUNET_TIME_absolute_get_forever(),
+ GNUNET_TIME_UNIT_FOREVER_ABS,
1,
&rd,
sig,
struct GNUNET_NAMESTORE_RecordData rd;
char* ip = TEST_IP;
struct in_addr *web = GNUNET_malloc(sizeof(struct in_addr));
- rd.expiration = GNUNET_TIME_absolute_get_forever ();
+ rd.expiration = GNUNET_TIME_UNIT_FOREVER_ABS;
GNUNET_assert(1 == inet_pton (AF_INET, ip, web));
rd.data_size = sizeof(struct in_addr);
rd.data = web;
struct in_addr *mail = GNUNET_malloc(sizeof(struct in_addr));
char *mx_record;
uint16_t mx_preference = 1;
- rd.expiration = GNUNET_TIME_absolute_get_forever ();
+ rd.expiration = GNUNET_TIME_UNIT_FOREVER_ABS;
GNUNET_assert(1 == inet_pton (AF_INET, ip, mail));
GNUNET_CRYPTO_short_hash(&bob_pkey, sizeof(bob_pkey), &bob_hash);
rd.data = mail;
rd.record_type = GNUNET_DNSPARSER_TYPE_A;
sig = GNUNET_NAMESTORE_create_signature(bob_key,
- GNUNET_TIME_absolute_get_forever(),
+ GNUNET_TIME_UNIT_FOREVER_ABS,
TEST_RECORD_NAME,
&rd, 1);
rd.data = mx_record;
rd.record_type = GNUNET_GNS_RECORD_MX;
sig = GNUNET_NAMESTORE_create_signature(bob_key,
- GNUNET_TIME_absolute_get_forever(),
+ GNUNET_TIME_UNIT_FOREVER_ABS,
"+",
&rd, 1);
GNUNET_NAMESTORE_record_put (namestore_handle,
struct GNUNET_NAMESTORE_RecordData rd;
char* ip = TEST_IP;
struct in_addr *web = GNUNET_malloc(sizeof(struct in_addr));
- rd.expiration = GNUNET_TIME_absolute_get_forever ();
+ rd.expiration = GNUNET_TIME_UNIT_FOREVER_ABS;
GNUNET_assert(1 == inet_pton (AF_INET, ip, web));
GNUNET_CRYPTO_short_hash(&bob_pkey, sizeof(bob_pkey), &bob_hash);
GNUNET_CRYPTO_short_hash(&alice_pkey, sizeof(alice_pkey), &alice_hash);
rd.data = &alice_hash;
sig = GNUNET_NAMESTORE_create_signature(bob_key,
- GNUNET_TIME_absolute_get_forever(),
+ GNUNET_TIME_UNIT_FOREVER_ABS,
TEST_AUTHORITY_ALICE,
&rd, 1);
GNUNET_NAMESTORE_record_put (namestore_handle,
&bob_pkey,
TEST_AUTHORITY_ALICE,
- GNUNET_TIME_absolute_get_forever(),
+ GNUNET_TIME_UNIT_FOREVER_ABS,
1,
&rd,
sig,
rd.data = web;
rd.record_type = GNUNET_DNSPARSER_TYPE_A;
sig = GNUNET_NAMESTORE_create_signature(alice_key,
- GNUNET_TIME_absolute_get_forever(),
+ GNUNET_TIME_UNIT_FOREVER_ABS,
TEST_RECORD_NAME,
&rd, 1);
GNUNET_NAMESTORE_record_put (namestore_handle,
&alice_pkey,
TEST_RECORD_NAME,
- GNUNET_TIME_absolute_get_forever(),
+ GNUNET_TIME_UNIT_FOREVER_ABS,
1,
&rd,
sig,
struct GNUNET_NAMESTORE_RecordData rd;
char* ip = TEST_IP;
struct in_addr *web = GNUNET_malloc(sizeof(struct in_addr));
- rd.expiration = GNUNET_TIME_absolute_get_forever ();
+ rd.expiration = GNUNET_TIME_UNIT_FOREVER_ABS;
GNUNET_assert(1 == inet_pton (AF_INET, ip, web));
GNUNET_CRYPTO_short_hash(&bob_pkey, sizeof(bob_pkey), &bob_hash);
rd.data = web;
rd.record_type = GNUNET_DNSPARSER_TYPE_A;
sig = GNUNET_NAMESTORE_create_signature(bob_key,
- GNUNET_TIME_absolute_get_forever(),
+ GNUNET_TIME_UNIT_FOREVER_ABS,
TEST_RECORD_NAME,
&rd, 1);
hostlist->hostlist_uri = (const char *) &hostlist[1];
memcpy (&hostlist[1], uri, uri_size);
hostlist->time_creation = GNUNET_TIME_absolute_get ();
- hostlist->time_last_usage = GNUNET_TIME_absolute_get_zero ();
hostlist->quality = HOSTLIST_INITIAL;
hostlist_to_test = hostlist;
/**
* Relative time zero.
*/
-#define GNUNET_TIME_UNIT_ZERO GNUNET_TIME_relative_get_zero()
+#define GNUNET_TIME_UNIT_ZERO GNUNET_TIME_relative_get_zero_()
/**
* Absolute time zero.
*/
-#define GNUNET_TIME_UNIT_ZERO_ABS GNUNET_TIME_absolute_get_zero()
+#define GNUNET_TIME_UNIT_ZERO_ABS GNUNET_TIME_absolute_get_zero_()
/**
* One millisecond, our basic time unit.
*/
-#define GNUNET_TIME_UNIT_MILLISECONDS GNUNET_TIME_relative_get_unit()
+#define GNUNET_TIME_UNIT_MILLISECONDS GNUNET_TIME_relative_get_unit_()
/**
* One second.
*/
-#define GNUNET_TIME_UNIT_SECONDS GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 1000)
+#define GNUNET_TIME_UNIT_SECONDS GNUNET_TIME_relative_get_second_()
/**
* One minute.
*/
-#define GNUNET_TIME_UNIT_MINUTES GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 60)
+#define GNUNET_TIME_UNIT_MINUTES GNUNET_TIME_relative_get_minute_()
/**
* One hour.
*/
-#define GNUNET_TIME_UNIT_HOURS GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES, 60)
+#define GNUNET_TIME_UNIT_HOURS GNUNET_TIME_relative_get_hour_()
/**
* One day.
* Constant used to specify "forever". This constant
* will be treated specially in all time operations.
*/
-#define GNUNET_TIME_UNIT_FOREVER_REL GNUNET_TIME_relative_get_forever ()
+#define GNUNET_TIME_UNIT_FOREVER_REL GNUNET_TIME_relative_get_forever_ ()
/**
* Constant used to specify "forever". This constant
* will be treated specially in all time operations.
*/
-#define GNUNET_TIME_UNIT_FOREVER_ABS GNUNET_TIME_absolute_get_forever ()
+#define GNUNET_TIME_UNIT_FOREVER_ABS GNUNET_TIME_absolute_get_forever_ ()
+
/**
* Return relative time of 0ms.
*/
struct GNUNET_TIME_Relative
-GNUNET_TIME_relative_get_zero (void);
+GNUNET_TIME_relative_get_zero_ (void);
+
/**
* Return absolute time of 0ms.
*/
struct GNUNET_TIME_Absolute
-GNUNET_TIME_absolute_get_zero (void);
+GNUNET_TIME_absolute_get_zero_ (void);
+
/**
* Return relative time of 1ms.
*/
struct GNUNET_TIME_Relative
-GNUNET_TIME_relative_get_unit (void);
+GNUNET_TIME_relative_get_unit_ (void);
+
+
+/**
+ * Return relative time of 1s.
+ */
+struct GNUNET_TIME_Relative
+GNUNET_TIME_relative_get_second_ (void);
+
+
+/**
+ * Return relative time of 1 minute.
+ */
+struct GNUNET_TIME_Relative
+GNUNET_TIME_relative_get_minute_ (void);
+
+
+/**
+ * Return relative time of 1 hour.
+ */
+struct GNUNET_TIME_Relative
+GNUNET_TIME_relative_get_hour_ (void);
+
/**
* Return "forever".
*/
struct GNUNET_TIME_Relative
-GNUNET_TIME_relative_get_forever (void);
+GNUNET_TIME_relative_get_forever_ (void);
+
/**
* Return "forever".
*/
struct GNUNET_TIME_Absolute
-GNUNET_TIME_absolute_get_forever (void);
+GNUNET_TIME_absolute_get_forever_ (void);
+
/**
* Get the current time.
struct GNUNET_TIME_Absolute
GNUNET_TIME_absolute_get (void);
+
/**
* Convert relative time to an absolute time in the
* future.
struct GNUNET_TIME_Absolute
GNUNET_TIME_relative_to_absolute (struct GNUNET_TIME_Relative rel);
+
/**
* Return the minimum of two relative time values.
*
struct GNUNET_TIME_Relative t2);
+
/**
* Return the maximum of two relative time values.
*
GNUNET_TIME_relative_max (struct GNUNET_TIME_Relative t1,
struct GNUNET_TIME_Relative t2);
+
/**
* Return the minimum of two absolute time values.
*
GNUNET_TIME_absolute_min (struct GNUNET_TIME_Absolute t1,
struct GNUNET_TIME_Absolute t2);
+
/**
* Return the maximum of two absolute time values.
*
GNUNET_TIME_absolute_max (struct GNUNET_TIME_Absolute t1,
struct GNUNET_TIME_Absolute t2);
+
/**
* Given a timestamp in the future, how much time
* remains until then?
GNUNET_TIME_absolute_get_difference (struct GNUNET_TIME_Absolute start,
struct GNUNET_TIME_Absolute end);
+
/**
* Get the duration of an operation as the
* difference of the current time and the given start time "hence".
GNUNET_TIME_absolute_subtract (struct GNUNET_TIME_Absolute start,
struct GNUNET_TIME_Relative duration);
+
/**
* Multiply relative time by a given factor.
*
GNUNET_TIME_relative_multiply (struct GNUNET_TIME_Relative rel,
unsigned int factor);
+
/**
* Divide relative time by a given factor.
*
GNUNET_TIME_relative_divide (struct GNUNET_TIME_Relative rel,
unsigned int factor);
+
/**
* Add relative times together.
*
GNUNET_TIME_relative_add (struct GNUNET_TIME_Relative a1,
struct GNUNET_TIME_Relative a2);
+
/**
* Subtract relative timestamp from the other.
*
struct GNUNET_TIME_RelativeNBO
GNUNET_TIME_relative_hton (struct GNUNET_TIME_Relative a);
+
/**
* Convert relative time from network byte order.
*
struct GNUNET_TIME_Relative
GNUNET_TIME_relative_ntoh (struct GNUNET_TIME_RelativeNBO a);
+
/**
* Convert relative time to network byte order.
*
struct GNUNET_TIME_AbsoluteNBO
GNUNET_TIME_absolute_hton (struct GNUNET_TIME_Absolute a);
+
/**
* Convert relative time from network byte order.
*
struct GNUNET_TIME_Absolute
GNUNET_TIME_absolute_ntoh (struct GNUNET_TIME_AbsoluteNBO a);
+
/**
* Convert a relative time to a string.
* NOT reentrant!
const char *
GNUNET_TIME_relative_to_string (struct GNUNET_TIME_Relative time);
+
/**
* Set the timestamp offset for this instance.
*
void
GNUNET_TIME_set_offset (long long offset);
+
#if 0 /* keep Emacsens' auto-indent happy */
{
#endif
if ((GNUNET_YES == pc->transport_connected) && (NULL == pc->th_ping))
pc->th_ping = GNUNET_TRANSPORT_notify_transmit_ready(th, &pc->id,
sizeof (struct PING), UINT_MAX,
- GNUNET_TIME_relative_get_forever(), &send_transport_ping_cb, pc);
+ GNUNET_TIME_UNIT_FOREVER_REL, &send_transport_ping_cb, pc);
else
GNUNET_break(0);
if ((GNUNET_YES == pc->core_connected) && (NULL == pc->ch_ping))
pc->ch_ping = GNUNET_CORE_notify_transmit_ready(ch,
GNUNET_NO, UINT_MAX,
- GNUNET_TIME_relative_get_forever(),
+ GNUNET_TIME_UNIT_FOREVER_REL,
&pc->id,
sizeof (struct PING),
send_core_ping_cb, pc);
if (GNUNET_YES == ping)
{
if (NULL == pc->th_ping)
- pc->th_ping = GNUNET_TRANSPORT_notify_transmit_ready(th, peer, sizeof (struct PING), UINT_MAX, GNUNET_TIME_relative_get_forever(), &send_transport_ping_cb, pc);
+ pc->th_ping = GNUNET_TRANSPORT_notify_transmit_ready(th, peer, sizeof (struct PING), UINT_MAX, GNUNET_TIME_UNIT_FOREVER_REL, &send_transport_ping_cb, pc);
else
GNUNET_break(0);
}
if (NULL == pc->ch_ping)
pc->ch_ping = GNUNET_CORE_notify_transmit_ready(ch,
GNUNET_NO, UINT_MAX,
- GNUNET_TIME_relative_get_forever(),
+ GNUNET_TIME_UNIT_FOREVER_REL,
peer,
sizeof (struct PING),
send_core_ping_cb, pc);
if (NULL == pc->th_pong)
pc->th_pong = GNUNET_TRANSPORT_notify_transmit_ready(th,
peer, sizeof (struct PONG),
- UINT_MAX, GNUNET_TIME_relative_get_forever(),
+ UINT_MAX, GNUNET_TIME_UNIT_FOREVER_REL,
&send_transport_pong_cb, pc);
else
GNUNET_break (0);
if (NULL == pc->ch_pong)
pc->ch_pong = GNUNET_CORE_notify_transmit_ready(ch,
GNUNET_NO, UINT_MAX,
- GNUNET_TIME_relative_get_forever(),
+ GNUNET_TIME_UNIT_FOREVER_REL,
peer,
sizeof (struct PONG),
send_core_pong_cb, pc);
GNUNET_BLOCK_TYPE_TEST, /* Block type */
sizeof (my_full_id), /* Size of the data */
(char *) &my_full_id, /* Data itself */
- GNUNET_TIME_absolute_get_forever (), /* Data expiration */
+ GNUNET_TIME_UNIT_FOREVER_ABS, /* Data expiration */
GNUNET_TIME_UNIT_FOREVER_REL, /* Retry time */
NULL, /* Continuation */
NULL); /* Continuation closure */
hosts);
GNUNET_assert (pg != NULL);
shutdown_handle =
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_get_forever (),
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
&shutdown_task, NULL);
}
hosts);
GNUNET_assert (pg != NULL);
shutdown_handle =
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_get_forever (),
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
&shutdown_task, NULL);
}
{
if (0 == strcmp (expirationstring, "never"))
{
- etime = GNUNET_TIME_relative_get_forever();
+ etime = GNUNET_TIME_UNIT_FOREVER_REL;
}
else if (GNUNET_OK !=
GNUNET_STRINGS_fancy_time_to_relative (expirationstring,
struct GNUNET_TIME_Absolute
get_block_expiration_time (unsigned int rd_count, const struct GNUNET_NAMESTORE_RecordData *rd)
{
- int c;
- struct GNUNET_TIME_Absolute expire = GNUNET_TIME_absolute_get_forever();
+ unsigned int c;
+ struct GNUNET_TIME_Absolute expire = GNUNET_TIME_UNIT_FOREVER_ABS;
+
if (NULL == rd)
- return GNUNET_TIME_absolute_get_zero();
- for (c = 0; c < rd_count; c++)
- {
- if (rd[c].expiration.abs_value < expire.abs_value)
- expire = rd[c].expiration;
- }
+ return GNUNET_TIME_UNIT_ZERO_ABS;
+ for (c = 0; c < rd_count; c++)
+ expire = GNUNET_TIME_absolute_min (rd[c].expiration, expire);
return expire;
}
zir_msg.gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_RESPONSE);
zir_msg.gns_header.header.size = htons (sizeof (struct ZoneIterationResponseMessage));
zir_msg.gns_header.r_id = htonl(zi->request_id);
- zir_msg.expire = GNUNET_TIME_absolute_hton(GNUNET_TIME_absolute_get_zero());
+ zir_msg.expire = GNUNET_TIME_absolute_hton(GNUNET_TIME_UNIT_ZERO_ABS);
zir_msg.name_len = htons (0);
zir_msg.reserved = htons (0);
zir_msg.rd_count = htons (0);
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "An error occured during zone to name operation\n");
if (qe->proc != NULL)
- qe->proc (qe->proc_cls, NULL, GNUNET_TIME_absolute_get_zero(), NULL, 0, NULL, NULL);
+ qe->proc (qe->proc_cls, NULL, GNUNET_TIME_UNIT_ZERO_ABS, NULL, 0, NULL, NULL);
}
else if (res == GNUNET_NO)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Namestore has no result for zone to name mapping \n");
if (qe->proc != NULL)
- qe->proc (qe->proc_cls, NULL, GNUNET_TIME_absolute_get_zero(), NULL, 0, NULL, NULL);
+ qe->proc (qe->proc_cls, NULL, GNUNET_TIME_UNIT_ZERO_ABS, NULL, 0, NULL, NULL);
}
else if (res == GNUNET_YES)
{
GNUNET_CONTAINER_DLL_remove(ze->h->z_head, ze->h->z_tail, ze);
if (ze->proc != NULL)
- ze->proc(ze->proc_cls, NULL, GNUNET_TIME_absolute_get_zero (), NULL , 0, NULL, NULL);
+ ze->proc(ze->proc_cls, NULL, GNUNET_TIME_UNIT_ZERO_ABS, NULL , 0, NULL, NULL);
GNUNET_free (ze);
return;
msg->rd_count = htons (1);
msg->rd_len = htons (rd_ser_len);
msg->pkey_len = htons (key_len);
- msg->expire = GNUNET_TIME_absolute_hton(GNUNET_TIME_absolute_get_forever());
+ msg->expire = GNUNET_TIME_absolute_hton(GNUNET_TIME_UNIT_FOREVER_ABS);
memcpy (pkey_tmp, pkey_enc, key_len);
memcpy (name_tmp, name, name_len);
memcpy (rd_tmp, rd_ser, rd_ser_len);
GNUNET_break (NULL != nsh);
GNUNET_NAMESTORE_record_put (nsh, &pubkey, name,
- GNUNET_TIME_absolute_get_forever(),
+ GNUNET_TIME_UNIT_FOREVER_ABS,
1, &rd, &signature, put_cont, name);
GNUNET_free ((void *)rd.data);
/* create a second record */
s_second_record = GNUNET_malloc(sizeof (struct GNUNET_NAMESTORE_RecordData) + TEST_CREATE_RECORD_DATALEN);
- s_second_record->expiration = GNUNET_TIME_absolute_get_forever();
+ s_second_record->expiration = GNUNET_TIME_UNIT_FOREVER_ABS;
s_second_record->record_type = TEST_CREATE_RECORD_TYPE;
s_second_record->flags = GNUNET_NAMESTORE_RF_AUTHORITY;
s_second_record->data = &s_second_record[1];
/* create a second record */
s_second_record = GNUNET_malloc(sizeof (struct GNUNET_NAMESTORE_RecordData) + TEST_CREATE_RECORD_DATALEN);
- s_second_record->expiration = GNUNET_TIME_absolute_get_forever();
+ s_second_record->expiration = GNUNET_TIME_UNIT_FOREVER_ABS;
s_second_record->record_type = TEST_CREATE_RECORD_TYPE;
s_second_record->flags = GNUNET_NAMESTORE_RF_AUTHORITY;
s_second_record->data = &s_second_record[1];
for (c = 0; c < count; c++)
{
- rd[c].expiration = GNUNET_TIME_absolute_get_zero();
- rd[c].record_type = TEST_RECORD_TYPE;
- rd[c].data_size = TEST_RECORD_DATALEN;
- rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN);
- memset ((char *) rd[c].data, TEST_RECORD_DATA, TEST_RECORD_DATALEN);
+ rd[c].expiration = GNUNET_TIME_UNIT_ZERO_ABS;
+ rd[c].record_type = TEST_RECORD_TYPE;
+ rd[c].data_size = TEST_RECORD_DATALEN;
+ rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN);
+ memset ((char *) rd[c].data, TEST_RECORD_DATA, TEST_RECORD_DATALEN);
}
return rd;
GNUNET_break (s_name != NULL);
GNUNET_NAMESTORE_record_put (nsh, &pubkey, s_name,
- GNUNET_TIME_absolute_get_forever(),
+ GNUNET_TIME_UNIT_FOREVER_ABS
RECORDS, s_rd, s_signature, put_cont, s_name);
for (c = 0; c < RECORDS-1; c++)
{
- rd[c].expiration = GNUNET_TIME_absolute_get_zero();
- rd[c].record_type = 1;
- rd[c].data_size = TEST_RECORD_DATALEN;
- rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN);
- memset ((char *) rd[c].data, TEST_RECORD_DATA, TEST_RECORD_DATALEN);
+ rd[c].expiration = GNUNET_TIME_UNIT_ZERO_ABS;
+ rd[c].record_type = 1;
+ rd[c].data_size = TEST_RECORD_DATALEN;
+ rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN);
+ memset ((char *) rd[c].data, TEST_RECORD_DATA, TEST_RECORD_DATALEN);
}
rd[c].expiration = GNUNET_TIME_absolute_get();
GNUNET_break (s_name != NULL);
GNUNET_NAMESTORE_record_put (nsh, &pubkey, s_name,
- GNUNET_TIME_absolute_get_forever(),
+ GNUNET_TIME_UNIT_FOREVER_ABS,
RECORDS, s_rd, s_signature, put_cont, s_name);
GNUNET_break (s_name != NULL);
GNUNET_NAMESTORE_record_put (nsh, &pubkey, s_name,
- GNUNET_TIME_absolute_get_forever(),
+ GNUNET_TIME_UNIT_FOREVER_ABS,
RECORDS, s_rd, signature, put_cont, s_name);
GNUNET_free (signature);
for (c = 1; c < RECORDS; c++)
{
- rd[c].expiration = GNUNET_TIME_absolute_get_zero();
- rd[c].record_type = TEST_RECORD_TYPE;
- rd[c].data_size = TEST_RECORD_DATALEN;
- rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN);
- memset ((char *) rd[c].data, TEST_RECORD_DATA, TEST_RECORD_DATALEN);
+ rd[c].expiration = GNUNET_TIME_UNIT_ZERO_ABS;
+ rd[c].record_type = TEST_RECORD_TYPE;
+ rd[c].data_size = TEST_RECORD_DATALEN;
+ rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN);
+ memset ((char *) rd[c].data, TEST_RECORD_DATA, TEST_RECORD_DATALEN);
}
return rd;
GNUNET_break (s_name != NULL);
GNUNET_NAMESTORE_record_put (nsh, &pubkey, s_name,
- GNUNET_TIME_absolute_get_forever(),
+ GNUNET_TIME_UNIT_FOREVER_ABS,
RECORDS, s_rd, s_signature, put_cont, s_name);
GNUNET_break (s_name != NULL);
GNUNET_NAMESTORE_record_put (nsh, &pubkey, s_name,
- GNUNET_TIME_absolute_get_forever(),
+ GNUNET_TIME_UNIT_FOREVER_ABS,
RECORDS, s_rd, s_signature, put_cont, s_name);
GNUNET_asprintf(&s_name_3, "dummy3");
s_rd_3 = create_record(1);
sig_3 = GNUNET_NAMESTORE_create_signature(privkey2, s_rd_3->expiration, s_name_3, s_rd_3, 1);
- GNUNET_NAMESTORE_record_put (nsh, &pubkey2, s_name_3, GNUNET_TIME_absolute_get_forever(), 1, s_rd_3, sig_3, &put_cont, NULL);
+ GNUNET_NAMESTORE_record_put (nsh, &pubkey2, s_name_3, GNUNET_TIME_UNIT_FOREVER_ABS, 1, s_rd_3, sig_3, &put_cont, NULL);
}
static int
GNUNET_asprintf(&s_name_3, "dummy3");
s_rd_3 = create_record(1);
sig_3 = GNUNET_NAMESTORE_create_signature(privkey, s_rd_3[0].expiration, s_name_3, s_rd_3, 1);
- GNUNET_NAMESTORE_record_put (nsh, &pubkey2, s_name_3, GNUNET_TIME_absolute_get_forever(), 1, s_rd_3, sig_3, &put_cont, NULL);
+ GNUNET_NAMESTORE_record_put (nsh, &pubkey2, s_name_3, GNUNET_TIME_UNIT_FOREVER_ABS, 1, s_rd_3, sig_3, &put_cont, NULL);
}
static int
GNUNET_asprintf(&s_name_3, "dummy3");
s_rd_3 = create_record(1);
sig_3 = GNUNET_NAMESTORE_create_signature(privkey2, s_rd_3[0].expiration, s_name_3, s_rd_3, 1);
- GNUNET_NAMESTORE_record_put (nsh, &pubkey2, s_name_3, GNUNET_TIME_absolute_get_forever(), 1, s_rd_3, sig_3, &put_cont, NULL);
+ GNUNET_NAMESTORE_record_put (nsh, &pubkey2, s_name_3, GNUNET_TIME_UNIT_FOREVER_ABS, 1, s_rd_3, sig_3, &put_cont, NULL);
}
static int
GNUNET_break (0);
res = 1;
}
- if (GNUNET_TIME_absolute_get_difference(src[c].expiration, dst[c].expiration).rel_value != GNUNET_TIME_relative_get_zero().rel_value)
+ if (0 != GNUNET_TIME_absolute_get_difference(src[c].expiration, dst[c].expiration).rel_value)
{
GNUNET_break (0);
res = 1;
&connect_cb, &my_cb, NULL, hosts);
GNUNET_assert (pg != NULL);
shutdown_handle =
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_get_forever (),
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
&shutdown_task, NULL);
}
AUTOSTART = NO
[testing]
-NUM_PEERS = 4000
+NUM_PEERS = 2000
WEAKRANDOM = YES
TOPOLOGY = NONE
#CONNECT_TOPOLOGY = SMALL_WORLD_RING
MAX_CONCURRENT_SSH = 20
USE_PROGRESSBARS = YES
PEERGROUP_TIMEOUT = 1000 s
-TOPOLOGY_OUTPUT_FILE = nse_topo_4000_peers_initial
+TOPOLOGY_OUTPUT_FILE = nse_topo_2000_peers_initial
MAX_OUTSTANDING_CONNECTIONS = 100
#SINGLE_PEERINFO_PER_HOST = YES
#NUM_PEERINFO_PER_HOST = 10
#SKEW_VARIANCE = 30000
[nse-profiler]
-OUTPUT_FILE = nse_output_4000_peers.dat
-TOPOLOGY_OUTPUT_FILE = nse_topo_4000_peers
-DATA_OUTPUT_FILE = nse_stats_4000_peers
+OUTPUT_FILE = nse_output_2000_peers.dat
+TOPOLOGY_OUTPUT_FILE = nse_topo_2000_peers
+DATA_OUTPUT_FILE = nse_stats_2000_peers
ROUND0 = 1000
-#ROUND1 = 4000
-ROUND2 = 4000
-ROUND3 = 4000
-ROUND4 = 4000
-ROUND5 = 4000
-ROUND6 = 4000
-ROUND7 = 4000
-ROUND8 = 4000
-ROUND9 = 4000
-ROUND10 = 4000
+#ROUND1 = 2000
+ROUND2 = 2000
+ROUND3 = 2000
+ROUND4 = 2000
+ROUND5 = 2000
+ROUND6 = 2000
+ROUND7 = 2000
+ROUND8 = 2000
+ROUND9 = 2000
+ROUND10 = 2000
ROUND11 = 1000
ROUND12 = 1000
ROUND13 = 1000
hosts);
GNUNET_assert (pg != NULL);
shutdown_handle =
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_get_forever (),
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
&shutdown_task, NULL);
}
core_context->stats_get_handle =
GNUNET_STATISTICS_get (core_context->stats_handle, NULL, NULL,
- GNUNET_TIME_relative_get_forever (),
+ GNUNET_TIME_UNIT_FOREVER_REL,
&internal_stats_cont, &internal_stats_callback,
core_context);
if (core_context->stats_get_handle == NULL)
s->addr = GNUNET_malloc (addrlen);
memcpy (s->addr, addr, addrlen);
s->addrlen = addrlen;
- s->next = NULL;
- s->next_receive = GNUNET_TIME_absolute_get_zero ();
s->ats_address_network_type = htonl (GNUNET_ATS_NET_UNSPECIFIED);
start_session_timeout(s);
return s;
s->ats_address_network_type = ats.value;
s->inbound = GNUNET_YES;
- s->next_receive = GNUNET_TIME_absolute_get_zero ();
+ s->next_receive = GNUNET_TIME_UNIT_ZERO_ABS;
s->tag = tag;
if (0 == strcmp (MHD_HTTP_METHOD_PUT, method))
s->server_recv = s;
GNUNET_break_op (0);
return NULL;
}
-
s->addrlen = len;
s->target = *target;
s->sock_addr = (const struct sockaddr *) &s[1];
- s->flow_delay_for_other_peer = GNUNET_TIME_relative_get_zero();
- s->flow_delay_from_other_peer = GNUNET_TIME_absolute_get_zero();
s->last_expected_delay = GNUNET_TIME_UNIT_SECONDS;
-
start_session_timeout(s);
-
return s;
}
sockaddr_in6)),
delay);
udpw = GNUNET_malloc (sizeof (struct UDPMessageWrapper) + msize);
- udpw->cont = NULL;
- udpw->cont_cls = NULL;
- udpw->frag_ctx = NULL;
udpw->msg_size = msize;
udpw->session = s;
- udpw->timeout = GNUNET_TIME_absolute_get_forever();
+ udpw->timeout = GNUNET_TIME_UNIT_FOREVER_ABS;
udpw->udp = (char *)&udpw[1];
-
udp_ack = (struct UDP_ACK_Message *) udpw->udp;
udp_ack->header.size = htons ((uint16_t) msize);
udp_ack->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_UDP_ACK);
struct GNUNET_TIME_RelativeNBO reln;
unsigned int i;
- forever = GNUNET_TIME_absolute_get_forever ();
- relForever = GNUNET_TIME_relative_get_forever ();
- relUnit = GNUNET_TIME_relative_get_unit ();
+ forever = GNUNET_TIME_UNIT_FOREVER_ABS;
+ relForever = GNUNET_TIME_UNIT_FOREVER_REL;
+ relUnit = GNUNET_TIME_UNIT_MILLISECONDS;
zero.abs_value = 0;
last = now = GNUNET_TIME_absolute_get ();
GNUNET_assert (rel.rel_value == GNUNET_TIME_UNIT_FOREVER_REL.rel_value);
/*check zero */
rel.rel_value = (UINT64_MAX) - 1024;
- GNUNET_assert (GNUNET_TIME_relative_get_zero ().rel_value ==
+ GNUNET_assert (GNUNET_TIME_UNIT_ZERO.rel_value ==
GNUNET_TIME_relative_multiply (rel, 0).rel_value);
/* test infinity-check for relative to absolute */
GNUNET_TIME_relative_to_absolute (rel).abs_value);
/*check forever */
rel.rel_value = UINT64_MAX;
- GNUNET_assert (GNUNET_TIME_absolute_get_forever ().abs_value ==
+ GNUNET_assert (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value ==
GNUNET_TIME_relative_to_absolute (rel).abs_value);
/* check overflow for r2a */
rel.rel_value = (UINT64_MAX) - 1024;
rel = GNUNET_TIME_absolute_get_remaining (future);
GNUNET_assert (rel.rel_value > 0);
GNUNET_assert (rel.rel_value <= 1000000);
- forever = GNUNET_TIME_absolute_get_forever ();
- GNUNET_assert (GNUNET_TIME_relative_get_forever ().rel_value ==
+ forever = GNUNET_TIME_UNIT_FOREVER_ABS;
+ GNUNET_assert (GNUNET_TIME_UNIT_FOREVER_REL.rel_value ==
GNUNET_TIME_absolute_get_remaining (forever).rel_value);
/* check endianess */
/* check Return absolute time of 0ms */
- zero = GNUNET_TIME_absolute_get_zero ();
+ zero = GNUNET_TIME_UNIT_ZERO_ABS;
/* check GNUNET_TIME_calculate_eta */
last.abs_value = GNUNET_TIME_absolute_get ().abs_value - 1024;
- forever = GNUNET_TIME_absolute_get_forever ();
+ forever = GNUNET_TIME_UNIT_FOREVER_ABS;
forever.abs_value = forever.abs_value - 1024;
- GNUNET_assert (GNUNET_TIME_absolute_get_zero ().abs_value ==
+ GNUNET_assert (GNUNET_TIME_UNIT_ZERO_ABS.abs_value ==
GNUNET_TIME_calculate_eta (forever, 50000, 100000).rel_value);
/* check zero */
GNUNET_log_skip (1, GNUNET_NO);
GNUNET_assert (1024 ==
GNUNET_TIME_relative_subtract (relForever, rel).rel_value);
/*check zero */
- GNUNET_assert (GNUNET_TIME_relative_get_zero ().rel_value ==
+ GNUNET_assert (GNUNET_TIME_UNIT_ZERO.rel_value ==
GNUNET_TIME_relative_subtract (rel, relForever).rel_value);
/*check forever */
rel.rel_value = UINT64_MAX;
- GNUNET_assert (GNUNET_TIME_relative_get_forever ().rel_value ==
+ GNUNET_assert (GNUNET_TIME_UNIT_FOREVER_REL.rel_value ==
GNUNET_TIME_relative_subtract (rel, relForever).rel_value);
/*check GNUNET_TIME_relative_min */
* Return relative time of 0ms.
*/
struct GNUNET_TIME_Relative
-GNUNET_TIME_relative_get_zero ()
+GNUNET_TIME_relative_get_zero_ ()
{
static struct GNUNET_TIME_Relative zero;
* Return absolute time of 0ms.
*/
struct GNUNET_TIME_Absolute
-GNUNET_TIME_absolute_get_zero ()
+GNUNET_TIME_absolute_get_zero_ ()
{
static struct GNUNET_TIME_Absolute zero;
return zero;
}
+
/**
* Return relative time of 1ms.
*/
struct GNUNET_TIME_Relative
-GNUNET_TIME_relative_get_unit ()
+GNUNET_TIME_relative_get_unit_ ()
{
static struct GNUNET_TIME_Relative one = { 1 };
return one;
}
+
+/**
+ * Return relative time of 1s.
+ */
+struct GNUNET_TIME_Relative
+GNUNET_TIME_relative_get_second_ ()
+{
+ static struct GNUNET_TIME_Relative one = { 1000 };
+ return one;
+}
+
+
+/**
+ * Return relative time of 1 minute.
+ */
+struct GNUNET_TIME_Relative
+GNUNET_TIME_relative_get_minute_ ()
+{
+ static struct GNUNET_TIME_Relative one = { 60 * 1000 };
+ return one;
+}
+
+
+/**
+ * Return relative time of 1 hour.
+ */
+struct GNUNET_TIME_Relative
+GNUNET_TIME_relative_get_hour_ ()
+{
+ static struct GNUNET_TIME_Relative one = { 60 * 60 * 1000 };
+ return one;
+}
+
+
/**
* Return "forever".
*/
struct GNUNET_TIME_Relative
-GNUNET_TIME_relative_get_forever ()
+GNUNET_TIME_relative_get_forever_ ()
{
static struct GNUNET_TIME_Relative forever = { UINT64_MAX };
return forever;
* Return "forever".
*/
struct GNUNET_TIME_Absolute
-GNUNET_TIME_absolute_get_forever ()
+GNUNET_TIME_absolute_get_forever_ ()
{
static struct GNUNET_TIME_Absolute forever = { UINT64_MAX };
return forever;
struct GNUNET_TIME_Absolute ret;
if (rel.rel_value == UINT64_MAX)
- return GNUNET_TIME_absolute_get_forever ();
+ return GNUNET_TIME_UNIT_FOREVER_ABS;
struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
if (rel.rel_value + now.abs_value < rel.rel_value)
{
GNUNET_break (0); /* overflow... */
- return GNUNET_TIME_absolute_get_forever ();
+ return GNUNET_TIME_UNIT_FOREVER_ABS;
}
ret.abs_value = rel.rel_value + now.abs_value;
return ret;
struct GNUNET_TIME_Relative ret;
if (future.abs_value == UINT64_MAX)
- return GNUNET_TIME_relative_get_forever ();
+ return GNUNET_TIME_UNIT_FOREVER_REL;
struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
if (now.abs_value > future.abs_value)
- return GNUNET_TIME_relative_get_zero ();
+ return GNUNET_TIME_UNIT_ZERO;
ret.rel_value = future.abs_value - now.abs_value;
return ret;
}
struct GNUNET_TIME_Relative ret;
if (end.abs_value == UINT64_MAX)
- return GNUNET_TIME_relative_get_forever ();
+ return GNUNET_TIME_UNIT_FOREVER_REL;
if (end.abs_value < start.abs_value)
- return GNUNET_TIME_relative_get_zero ();
+ return GNUNET_TIME_UNIT_ZERO;
ret.rel_value = end.abs_value - start.abs_value;
return ret;
}
now = GNUNET_TIME_absolute_get ();
GNUNET_assert (whence.abs_value != UINT64_MAX);
if (whence.abs_value > now.abs_value)
- return GNUNET_TIME_relative_get_zero ();
+ return GNUNET_TIME_UNIT_ZERO;
ret.rel_value = now.abs_value - whence.abs_value;
return ret;
}
struct GNUNET_TIME_Absolute ret;
if ((start.abs_value == UINT64_MAX) || (duration.rel_value == UINT64_MAX))
- return GNUNET_TIME_absolute_get_forever ();
+ return GNUNET_TIME_UNIT_FOREVER_ABS;
if (start.abs_value + duration.rel_value < start.abs_value)
{
GNUNET_break (0);
- return GNUNET_TIME_absolute_get_forever ();
+ return GNUNET_TIME_UNIT_FOREVER_ABS;
}
ret.abs_value = start.abs_value + duration.rel_value;
return ret;
struct GNUNET_TIME_Relative ret;
if (factor == 0)
- return GNUNET_TIME_relative_get_zero ();
+ return GNUNET_TIME_UNIT_ZERO;
ret.rel_value = rel.rel_value * (unsigned long long) factor;
if (ret.rel_value / factor != rel.rel_value)
{
GNUNET_break (0);
- return GNUNET_TIME_relative_get_forever ();
+ return GNUNET_TIME_UNIT_FOREVER_REL;
}
return ret;
}
struct GNUNET_TIME_Relative ret;
if ((a1.rel_value == UINT64_MAX) || (a2.rel_value == UINT64_MAX))
- return GNUNET_TIME_relative_get_forever ();
+ return GNUNET_TIME_UNIT_FOREVER_REL;
if (a1.rel_value + a2.rel_value < a1.rel_value)
{
GNUNET_break (0);
- return GNUNET_TIME_relative_get_forever ();
+ return GNUNET_TIME_UNIT_FOREVER_REL;
}
ret.rel_value = a1.rel_value + a2.rel_value;
return ret;
struct GNUNET_TIME_Relative ret;
if (a2.rel_value >= a1.rel_value)
- return GNUNET_TIME_relative_get_zero ();
+ return GNUNET_TIME_UNIT_ZERO;
if (a1.rel_value == UINT64_MAX)
- return GNUNET_TIME_relative_get_forever ();
+ return GNUNET_TIME_UNIT_FOREVER_REL;
ret.rel_value = a1.rel_value - a2.rel_value;
return ret;
}