Time and time calculations. More...
Data Structures | |
struct | GNUNET_TIME_Absolute |
Time for absolute times used by GNUnet, in microseconds. More... | |
struct | GNUNET_TIME_Timestamp |
Time for timestamps used by GNUnet, in microseconds rounded to seconds. More... | |
struct | GNUNET_TIME_Relative |
Time for relative time used by GNUnet, in microseconds. More... | |
struct | GNUNET_TIME_RelativeNBO |
Time for relative time used by GNUnet, in microseconds and in network byte order. More... | |
struct | GNUNET_TIME_AbsoluteNBO |
Time for absolute time used by GNUnet, in microseconds and in network byte order. More... | |
struct | GNUNET_TIME_TimestampNBO |
Time for timestamps used by GNUnet, in seconds and in network byte order. More... | |
Macros | |
#define | GNUNET_TIME_UNIT_ZERO ((struct GNUNET_TIME_Relative){0}) |
Relative time zero. More... | |
#define | GNUNET_TIME_UNIT_ZERO_ABS ((struct GNUNET_TIME_Absolute){0}) |
Absolute time zero. More... | |
#define | GNUNET_TIME_UNIT_ZERO_TS ((struct GNUNET_TIME_Timestamp){{0}}) |
Timestamp of zero. More... | |
#define | GNUNET_TIME_UNIT_MICROSECONDS GNUNET_TIME_relative_get_unit_ () |
One microsecond, our basic time unit. More... | |
#define | GNUNET_TIME_UNIT_MILLISECONDS GNUNET_TIME_relative_get_millisecond_ () |
One millisecond. More... | |
#define | GNUNET_TIME_UNIT_SECONDS GNUNET_TIME_relative_get_second_ () |
One second. More... | |
#define | GNUNET_TIME_UNIT_MINUTES GNUNET_TIME_relative_get_minute_ () |
One minute. More... | |
#define | GNUNET_TIME_UNIT_HOURS GNUNET_TIME_relative_get_hour_ () |
One hour. More... | |
#define | GNUNET_TIME_UNIT_DAYS |
One day. More... | |
#define | GNUNET_TIME_UNIT_WEEKS |
One week. More... | |
#define | GNUNET_TIME_UNIT_MONTHS |
One month (30 days). More... | |
#define | GNUNET_TIME_UNIT_YEARS |
One year (365 days). More... | |
#define | GNUNET_TIME_UNIT_FOREVER_REL ((struct GNUNET_TIME_Relative){UINT64_MAX}) |
Constant used to specify "forever". More... | |
#define | GNUNET_TIME_UNIT_FOREVER_ABS ((struct GNUNET_TIME_Absolute){UINT64_MAX}) |
Constant used to specify "forever". More... | |
#define | GNUNET_TIME_UNIT_NEVER_ABS ((struct GNUNET_TIME_Absolute){UINT64_MAX}) |
#define | GNUNET_TIME_UNIT_FOREVER_TS ((struct GNUNET_TIME_Timestamp){{UINT64_MAX}}) |
Constant used to specify "forever". More... | |
#define | GNUNET_TIME_STD_EXPONENTIAL_BACKOFF_THRESHOLD GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 15) |
Threshold after which exponential backoff should not increase (15 m). More... | |
#define | GNUNET_TIME_STD_BACKOFF(r) |
Perform our standard exponential back-off calculation, starting at 1 ms and then going by a factor of 2 up unto a maximum of 15 m. More... | |
#define | GNUNET_TIME_absolute_cmp(t1, op, t2) ((void) (1 op 2), (t1).abs_value_us op (t2).abs_value_us) |
Compare two absolute times. More... | |
#define | GNUNET_TIME_timestamp_cmp(t1, op, t2) GNUNET_TIME_absolute_cmp ((t1).abs_time,op,(t2).abs_time) |
Compare two timestamps. More... | |
#define | GNUNET_TIME_relative_cmp(t1, op, t2) ((void) (1 op 2), (t1).rel_value_us op (t2).rel_value_us) |
Compare two relative times. More... | |
Functions | |
enum GNUNET_GenericReturnValue | GNUNET_STRINGS_fancy_time_to_absolute (const char *fancy_time, struct GNUNET_TIME_Absolute *atime) |
Convert a given fancy human-readable time to our internal representation. More... | |
enum GNUNET_GenericReturnValue | GNUNET_STRINGS_fancy_time_to_timestamp (const char *fancy_time, struct GNUNET_TIME_Timestamp *atime) |
Convert a given fancy human-readable time to our internal representation. More... | |
const char * | GNUNET_STRINGS_timestamp_to_string (struct GNUNET_TIME_Timestamp t) |
Like asctime , except for GNUnet time. More... | |
const char * | GNUNET_STRINGS_absolute_time_to_string (struct GNUNET_TIME_Absolute t) |
Like asctime , except for GNUnet time. More... | |
const char * | GNUNET_STRINGS_relative_time_to_string (struct GNUNET_TIME_Relative delta, int do_round) |
Give relative time in human-readable fancy format. More... | |
const char * | GNUNET_TIME_timestamp2s (struct GNUNET_TIME_Timestamp ts) |
Convert ts to human-readable timestamp. More... | |
const char * | GNUNET_TIME_absolute2s (struct GNUNET_TIME_Absolute ts) |
Like asctime , except for GNUnet time. More... | |
const char * | GNUNET_TIME_relative2s (struct GNUNET_TIME_Relative delta, bool do_round) |
Give relative time in human-readable fancy format. More... | |
struct GNUNET_TIME_Relative | GNUNET_TIME_randomized_backoff (struct GNUNET_TIME_Relative rt, struct GNUNET_TIME_Relative threshold) |
Randomized exponential back-off, starting at 1 ms and going up by a factor of 2+r, where 0 <= r <= 0.5, up to a maximum of the given threshold. More... | |
struct GNUNET_TIME_Relative | GNUNET_TIME_randomize (struct GNUNET_TIME_Relative r) |
Return a random time value between 0.5*r and 1.5*r. More... | |
struct GNUNET_TIME_Relative | GNUNET_TIME_relative_get_zero_ (void) |
Return relative time of 0ms. More... | |
struct GNUNET_TIME_Absolute | GNUNET_TIME_absolute_get_zero_ (void) |
Return absolute time of 0ms. More... | |
struct GNUNET_TIME_Relative | GNUNET_TIME_relative_get_unit_ (void) |
Return relative time of 1 microsecond. More... | |
struct GNUNET_TIME_Relative | GNUNET_TIME_relative_get_millisecond_ (void) |
Return relative time of 1ms. More... | |
struct GNUNET_TIME_Relative | GNUNET_TIME_relative_get_second_ (void) |
Return relative time of 1s. More... | |
struct GNUNET_TIME_Relative | GNUNET_TIME_relative_get_minute_ (void) |
Return relative time of 1 minute. More... | |
struct GNUNET_TIME_Relative | GNUNET_TIME_relative_get_hour_ (void) |
Return relative time of 1 hour. More... | |
struct GNUNET_TIME_Relative | GNUNET_TIME_relative_get_forever_ (void) |
Return "forever". More... | |
struct GNUNET_TIME_Absolute | GNUNET_TIME_absolute_get_forever_ (void) |
Return "forever". More... | |
struct GNUNET_TIME_Absolute | GNUNET_TIME_absolute_get (void) |
Get the current time. More... | |
struct GNUNET_TIME_Absolute | GNUNET_TIME_relative_to_absolute (struct GNUNET_TIME_Relative rel) |
Convert relative time to an absolute time in the future. More... | |
struct GNUNET_TIME_Timestamp | GNUNET_TIME_relative_to_timestamp (struct GNUNET_TIME_Relative rel) |
Convert relative time to a timestamp in the future. More... | |
struct GNUNET_TIME_Timestamp | GNUNET_TIME_absolute_to_timestamp (struct GNUNET_TIME_Absolute at) |
Round an absolute time to a timestamp. More... | |
struct GNUNET_TIME_Timestamp | GNUNET_TIME_timestamp_get (void) |
Get timestamp representing the current time. More... | |
struct GNUNET_TIME_Relative | GNUNET_TIME_relative_min (struct GNUNET_TIME_Relative t1, struct GNUNET_TIME_Relative t2) |
Return the minimum of two relative time values. More... | |
struct GNUNET_TIME_Relative | GNUNET_TIME_relative_max (struct GNUNET_TIME_Relative t1, struct GNUNET_TIME_Relative t2) |
Return the maximum of two relative time values. More... | |
struct GNUNET_TIME_Absolute | GNUNET_TIME_absolute_min (struct GNUNET_TIME_Absolute t1, struct GNUNET_TIME_Absolute t2) |
Return the minimum of two absolute time values. More... | |
struct GNUNET_TIME_Absolute | GNUNET_TIME_absolute_max (struct GNUNET_TIME_Absolute t1, struct GNUNET_TIME_Absolute t2) |
Return the maximum of two absolute time values. More... | |
struct GNUNET_TIME_Absolute | GNUNET_TIME_absolute_round_down (struct GNUNET_TIME_Absolute at, struct GNUNET_TIME_Relative rt) |
Round down absolute time at to multiple of rt. More... | |
struct GNUNET_TIME_Timestamp | GNUNET_TIME_timestamp_max (struct GNUNET_TIME_Timestamp t1, struct GNUNET_TIME_Timestamp t2) |
Return the maximum of two timestamps. More... | |
struct GNUNET_TIME_Timestamp | GNUNET_TIME_timestamp_min (struct GNUNET_TIME_Timestamp t1, struct GNUNET_TIME_Timestamp t2) |
Return the minimum of two timestamps. More... | |
struct GNUNET_TIME_Relative | GNUNET_TIME_absolute_get_remaining (struct GNUNET_TIME_Absolute future) |
Given a timestamp in the future, how much time remains until then? More... | |
bool | GNUNET_TIME_absolute_approx_eq (struct GNUNET_TIME_Absolute a1, struct GNUNET_TIME_Absolute a2, struct GNUNET_TIME_Relative t) |
Test if a1 and a2 are equal within a margin of error of t. More... | |
struct GNUNET_TIME_Relative | GNUNET_TIME_calculate_eta (struct GNUNET_TIME_Absolute start, uint64_t finished, uint64_t total) |
Calculate the estimate time of arrival/completion for an operation. More... | |
struct GNUNET_TIME_Relative | GNUNET_TIME_absolute_get_difference (struct GNUNET_TIME_Absolute start, struct GNUNET_TIME_Absolute end) |
Compute the time difference between the given start and end times. More... | |
struct GNUNET_TIME_Relative | GNUNET_TIME_absolute_get_duration (struct GNUNET_TIME_Absolute whence) |
Get the duration of an operation as the difference of the current time and the given start time "hence". More... | |
struct GNUNET_TIME_Absolute | GNUNET_TIME_absolute_add (struct GNUNET_TIME_Absolute start, struct GNUNET_TIME_Relative duration) |
Add a given relative duration to the given start time. More... | |
struct GNUNET_TIME_Absolute | GNUNET_TIME_absolute_subtract (struct GNUNET_TIME_Absolute start, struct GNUNET_TIME_Relative duration) |
Subtract a given relative duration from the given start time. More... | |
struct GNUNET_TIME_Relative | GNUNET_TIME_relative_multiply_double (struct GNUNET_TIME_Relative rel, double factor) |
Multiply relative time by a given factor. More... | |
struct GNUNET_TIME_Relative | GNUNET_TIME_relative_multiply (struct GNUNET_TIME_Relative rel, unsigned long long factor) |
Multiply relative time by a given factor. More... | |
struct GNUNET_TIME_Relative | GNUNET_TIME_relative_saturating_multiply (struct GNUNET_TIME_Relative rel, unsigned long long factor) |
Saturating multiply relative time by a given factor. More... | |
struct GNUNET_TIME_Relative | GNUNET_TIME_relative_divide (struct GNUNET_TIME_Relative rel, unsigned long long factor) |
Divide relative time by a given factor. More... | |
struct GNUNET_TIME_Relative | GNUNET_TIME_relative_add (struct GNUNET_TIME_Relative a1, struct GNUNET_TIME_Relative a2) |
Add relative times together. More... | |
struct GNUNET_TIME_Relative | GNUNET_TIME_relative_subtract (struct GNUNET_TIME_Relative a1, struct GNUNET_TIME_Relative a2) |
Subtract relative timestamp from the other. More... | |
struct GNUNET_TIME_RelativeNBO | GNUNET_TIME_relative_hton (struct GNUNET_TIME_Relative a) |
Convert relative time to network byte order. More... | |
struct GNUNET_TIME_Relative | GNUNET_TIME_relative_ntoh (struct GNUNET_TIME_RelativeNBO a) |
Convert relative time from network byte order. More... | |
struct GNUNET_TIME_AbsoluteNBO | GNUNET_TIME_absolute_hton (struct GNUNET_TIME_Absolute a) |
Convert absolute time to network byte order. More... | |
struct GNUNET_TIME_TimestampNBO | GNUNET_TIME_timestamp_hton (struct GNUNET_TIME_Timestamp t) |
Convert timestamp to network byte order. More... | |
struct GNUNET_TIME_Absolute | GNUNET_TIME_absolute_from_ms (uint64_t ms_after_epoch) |
Convert milliseconds after the UNIX epoch to absolute time. More... | |
bool | GNUNET_TIME_absolute_is_never (struct GNUNET_TIME_Absolute abs) |
Test if abs is never. More... | |
bool | GNUNET_TIME_absolute_is_past (struct GNUNET_TIME_Absolute abs) |
Test if abs is truly in the past (excluding now). More... | |
bool | GNUNET_TIME_absolute_is_zero (struct GNUNET_TIME_Absolute abs) |
Test if abs is truly zero. More... | |
bool | GNUNET_TIME_absolute_is_future (struct GNUNET_TIME_Absolute abs) |
Test if abs is truly in the future (excluding now). More... | |
bool | GNUNET_TIME_relative_is_forever (struct GNUNET_TIME_Relative rel) |
Test if rel is forever. More... | |
bool | GNUNET_TIME_relative_is_zero (struct GNUNET_TIME_Relative rel) |
Test if rel is zero. More... | |
struct GNUNET_TIME_Absolute | GNUNET_TIME_absolute_from_s (uint64_t s_after_epoch) |
Convert seconds after the UNIX epoch to absolute time. More... | |
struct GNUNET_TIME_Timestamp | GNUNET_TIME_timestamp_from_s (uint64_t s_after_epoch) |
Convert seconds after the UNIX epoch to timestamp. More... | |
uint64_t | GNUNET_TIME_timestamp_to_s (struct GNUNET_TIME_Timestamp ts) |
Convert timestamp to number of seconds after the UNIX epoch. More... | |
struct GNUNET_TIME_Absolute | GNUNET_TIME_absolute_ntoh (struct GNUNET_TIME_AbsoluteNBO a) |
Convert absolute time from network byte order. More... | |
struct GNUNET_TIME_Timestamp | GNUNET_TIME_timestamp_ntoh (struct GNUNET_TIME_TimestampNBO tn) |
Convert timestamp from network byte order. More... | |
void | GNUNET_TIME_set_offset (long long offset) |
Set the timestamp offset for this instance. More... | |
long long | GNUNET_TIME_get_offset (void) |
Get the timestamp offset for this instance. More... | |
unsigned int | GNUNET_TIME_get_current_year (void) |
Return the current year (e.g. More... | |
struct GNUNET_TIME_Absolute | GNUNET_TIME_year_to_time (unsigned int year) |
Convert a year to an expiration time of January 1st of that year. More... | |
unsigned int | GNUNET_TIME_time_to_year (struct GNUNET_TIME_Absolute at) |
Convert an expiration time to the respective year (rounds) More... | |
struct GNUNET_TIME_Absolute | GNUNET_TIME_absolute_get_monotonic (const struct GNUNET_CONFIGURATION_Handle *cfg) |
Obtain the current time and make sure it is monotonically increasing. More... | |
Time and time calculations.
#define GNUNET_TIME_UNIT_ZERO ((struct GNUNET_TIME_Relative){0}) |
Relative time zero.
Definition at line 131 of file gnunet_time_lib.h.
#define GNUNET_TIME_UNIT_ZERO_ABS ((struct GNUNET_TIME_Absolute){0}) |
Absolute time zero.
Definition at line 136 of file gnunet_time_lib.h.
#define GNUNET_TIME_UNIT_ZERO_TS ((struct GNUNET_TIME_Timestamp){{0}}) |
Timestamp of zero.
Definition at line 141 of file gnunet_time_lib.h.
#define GNUNET_TIME_UNIT_MICROSECONDS GNUNET_TIME_relative_get_unit_ () |
One microsecond, our basic time unit.
Definition at line 146 of file gnunet_time_lib.h.
#define GNUNET_TIME_UNIT_MILLISECONDS GNUNET_TIME_relative_get_millisecond_ () |
One millisecond.
Definition at line 151 of file gnunet_time_lib.h.
#define GNUNET_TIME_UNIT_SECONDS GNUNET_TIME_relative_get_second_ () |
One second.
Definition at line 156 of file gnunet_time_lib.h.
#define GNUNET_TIME_UNIT_MINUTES GNUNET_TIME_relative_get_minute_ () |
One minute.
Definition at line 161 of file gnunet_time_lib.h.
#define GNUNET_TIME_UNIT_HOURS GNUNET_TIME_relative_get_hour_ () |
One hour.
Definition at line 166 of file gnunet_time_lib.h.
#define GNUNET_TIME_UNIT_DAYS |
One day.
Definition at line 171 of file gnunet_time_lib.h.
#define GNUNET_TIME_UNIT_WEEKS |
#define GNUNET_TIME_UNIT_MONTHS |
One month (30 days).
Definition at line 183 of file gnunet_time_lib.h.
#define GNUNET_TIME_UNIT_YEARS |
One year (365 days).
Definition at line 189 of file gnunet_time_lib.h.
#define GNUNET_TIME_UNIT_FOREVER_REL ((struct GNUNET_TIME_Relative){UINT64_MAX}) |
Constant used to specify "forever".
This constant will be treated specially in all time operations.
Definition at line 196 of file gnunet_time_lib.h.
#define GNUNET_TIME_UNIT_FOREVER_ABS ((struct GNUNET_TIME_Absolute){UINT64_MAX}) |
Constant used to specify "forever".
This constant will be treated specially in all time operations.
Definition at line 203 of file gnunet_time_lib.h.
#define GNUNET_TIME_UNIT_NEVER_ABS ((struct GNUNET_TIME_Absolute){UINT64_MAX}) |
Definition at line 205 of file gnunet_time_lib.h.
#define GNUNET_TIME_UNIT_FOREVER_TS ((struct GNUNET_TIME_Timestamp){{UINT64_MAX}}) |
Constant used to specify "forever".
This constant will be treated specially in all time operations.
Definition at line 212 of file gnunet_time_lib.h.
#define GNUNET_TIME_STD_EXPONENTIAL_BACKOFF_THRESHOLD GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 15) |
Threshold after which exponential backoff should not increase (15 m).
Definition at line 219 of file gnunet_time_lib.h.
#define GNUNET_TIME_STD_BACKOFF | ( | r | ) |
Perform our standard exponential back-off calculation, starting at 1 ms and then going by a factor of 2 up unto a maximum of 15 m.
r | current backoff time, initially zero |
Definition at line 229 of file gnunet_time_lib.h.
#define GNUNET_TIME_absolute_cmp | ( | t1, | |
op, | |||
t2 | |||
) | ((void) (1 op 2), (t1).abs_value_us op (t2).abs_value_us) |
Compare two absolute times.
t1 | first time |
op | compare operator |
t2 | second time |
Definition at line 421 of file gnunet_time_lib.h.
#define GNUNET_TIME_timestamp_cmp | ( | t1, | |
op, | |||
t2 | |||
) | GNUNET_TIME_absolute_cmp ((t1).abs_time,op,(t2).abs_time) |
Compare two timestamps.
t1 | first timestamp |
op | compare operator |
t2 | second timestamp |
Definition at line 433 of file gnunet_time_lib.h.
#define GNUNET_TIME_relative_cmp | ( | t1, | |
op, | |||
t2 | |||
) | ((void) (1 op 2), (t1).rel_value_us op (t2).rel_value_us) |
Compare two relative times.
t1 | first time |
op | compare operator |
t2 | second time |
Definition at line 445 of file gnunet_time_lib.h.
enum GNUNET_GenericReturnValue GNUNET_STRINGS_fancy_time_to_absolute | ( | const char * | fancy_time, |
struct GNUNET_TIME_Absolute * | atime | ||
) |
Convert a given fancy human-readable time to our internal representation.
The human-readable time is expected to be in local time, whereas the returned value will be in UTC.
fancy_time | human readable string (e.g. Y-m-d H:M:S) |
atime | set to the absolute time |
Definition at line 301 of file strings.c.
References GNUNET_TIME_Absolute::abs_value_us, GNUNET_OK, GNUNET_SYSERR, GNUNET_TIME_UNIT_FOREVER_ABS, and t.
Referenced by GNUNET_STRINGS_fancy_time_to_timestamp(), parse_expiration(), set_absolute_time(), set_timestamp(), and sign_cb().
enum GNUNET_GenericReturnValue GNUNET_STRINGS_fancy_time_to_timestamp | ( | const char * | fancy_time, |
struct GNUNET_TIME_Timestamp * | atime | ||
) |
Convert a given fancy human-readable time to our internal representation.
The human-readable time is expected to be in local time, whereas the returned value will be in UTC.
fancy_time | human readable string (e.g. Y-m-d H:M:S) |
atime | set to the absolute time |
Definition at line 333 of file strings.c.
References GNUNET_TIME_Timestamp::abs_time, GNUNET_OK, GNUNET_STRINGS_fancy_time_to_absolute(), GNUNET_TIME_absolute_is_never(), GNUNET_TIME_UNIT_FOREVER_TS, and ret.
const char * GNUNET_STRINGS_timestamp_to_string | ( | struct GNUNET_TIME_Timestamp | t | ) |
Like asctime
, except for GNUnet time.
Converts a GNUnet internal absolute time (which is in UTC) to a string in local time. Note that the returned value will be overwritten if this function is called again.
t | the timestamp to convert |
Definition at line 626 of file strings.c.
References GNUNET_TIME_Absolute::abs_value_us, GNUNET_STRINGS_absolute_time_to_string(), GNUNET_TIME_UNIT_FOREVER_ABS, GNUNET_TIME_UNIT_FOREVER_TS, and t.
const char * GNUNET_STRINGS_absolute_time_to_string | ( | struct GNUNET_TIME_Absolute | t | ) |
Like asctime
, except for GNUnet time.
Converts a GNUnet internal absolute time (which is in UTC) to a string in local time. Note that the returned value will be overwritten if this function is called again.
t | the absolute time to convert |
Definition at line 640 of file strings.c.
References GNUNET_THREAD_LOCAL, GNUNET_TIME_absolute_is_never(), t, and tt.
Referenced by block_decrypt_ecdsa(), block_decrypt_eddsa(), dispatch_job(), display_record(), do_rekey(), execute_get(), get_resp_callback(), get_transmit_delay(), GNUNET_FS_meta_data_add_publication_date(), GNUNET_GNSRECORD_record_get_expiration_time(), GNUNET_PEERSTORE_hello_add(), GNUNET_STRINGS_timestamp_to_string(), got_hello(), handle_dht_response(), handle_estimate(), handle_namecache_block_response(), handle_p2p_estimate(), handle_validation_response(), hello_add_iter(), hello_iter(), inject_rekey(), learn_dv_path(), monitor_cb(), monitor_notify_connect(), monitor_notify_disconnect(), namecache_sqlite_cache_block(), ns_lookup_result_cb(), parse_expiration(), print_info(), print_plugin_event_info(), printer(), printer_watch(), process_queue(), process_record(), put_callback(), select_loop(), sqlite_plugin_put(), store_pi(), timeout_cb(), transmit_item(), transmit_on_queue(), transmit_task_cb(), update_pm_next_attempt(), and warn_monitor_slow().
const char * GNUNET_STRINGS_relative_time_to_string | ( | struct GNUNET_TIME_Relative | delta, |
int | do_round | ||
) |
Give relative time in human-readable fancy format.
This is one of the very few calls in the entire API that is NOT reentrant!
delta | time in milli seconds |
do_round | are we allowed to round a bit? |
Definition at line 579 of file strings.c.
References delta, do_round(), GNUNET_snprintf(), GNUNET_THREAD_LOCAL, GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_YES, and GNUNET_TIME_Relative::rel_value_us.
Referenced by channel_open_sent_cb(), connect_fail_continuation(), consider_sending_fc(), data_sent_cb(), delay_warning(), delayed_restart_task(), disconnect_and_schedule_reconnect(), display_record(), do_disconnect(), do_shutdown(), do_speedup(), expired_processor(), find_proof(), flush_bulk(), get_delay_randomization(), get_transmit_delay(), GNUNET_BANDWIDTH_tracker_get_delay(), GNUNET_BANDWIDTH_value_get_available_until(), GNUNET_BANDWIDTH_value_get_delay_for(), GNUNET_DATASTORE_put(), GNUNET_HOSTLIST_client_start(), GNUNET_SCHEDULER_do_work(), GNUNET_SPEEDUP_start_(), GNUNET_TESTING_interpreter_next_(), GSC_CLIENTS_solicit_request(), GSF_block_peer_migration_(), handle_announce(), handle_client_join(), handle_client_send(), handle_data(), handle_dv_learn(), handle_encrypted(), handle_p2p_migration_stop(), handle_p2p_put(), handler_advertisement(), list_callback(), maint_child_death(), manage_first_hop_mq(), monitor_cb(), odc_warn_delay_task(), parse_expiration(), plan(), print_plugin_event_info(), process_job_queue(), process_lookup_result(), process_stat(), process_stdin(), progress_cb(), put_migration_continuation(), queue_read(), queue_timeout(), quota_processor(), read_send(), RECLAIM_TICKETS_init(), reconnect(), regex_found_handler(), reschedule_connect(), run(), schedule_peer_transmission(), search_timed_out(), shutdown_task(), sqlite_plugin_put(), start_dv_learn(), store_completed_cb(), task_check(), task_hostlist_saving(), test_master(), timeout_cb(), transmit_item(), transmit_on_queue(), try_reconnect(), try_transmission(), update_excess(), update_tracker(), update_velocity(), validation_start_cb(), warn_delay(), warn_delay_task(), warn_no_client_continue(), and zone_iteration_finished().
const char * GNUNET_TIME_timestamp2s | ( | struct GNUNET_TIME_Timestamp | ts | ) |
Convert ts to human-readable timestamp.
Note that the returned value will be overwritten if this function is called again.
ts | the timestamp to convert |
Definition at line 214 of file time.c.
References GNUNET_TIME_Timestamp::abs_time, GNUNET_TIME_Absolute::abs_value_us, GNUNET_THREAD_LOCAL, GNUNET_TIME_absolute_is_never(), and tt.
const char * GNUNET_TIME_absolute2s | ( | struct GNUNET_TIME_Absolute | ts | ) |
Like asctime
, except for GNUnet time.
Converts a GNUnet internal absolute time (which is in UTC) to a string in local time. Note that the returned value will be overwritten if this function is called again.
ts | the absolute time to convert |
Definition at line 239 of file time.c.
References GNUNET_THREAD_LOCAL, GNUNET_TIME_absolute_is_never(), t, and tt.
const char * GNUNET_TIME_relative2s | ( | struct GNUNET_TIME_Relative | delta, |
bool | do_round | ||
) |
Give relative time in human-readable fancy format.
This is one of the very few calls in the entire API that is NOT reentrant!
delta | time in milli seconds |
do_round | are we allowed to round a bit? |
Definition at line 264 of file time.c.
References delta, do_round(), GNUNET_snprintf(), GNUNET_THREAD_LOCAL, GNUNET_TIME_relative_is_forever(), GNUNET_YES, and GNUNET_TIME_Relative::rel_value_us.
Referenced by free_timedout_queue_entry(), GNUNET_CURL_perform2(), and GNUNET_get_udp_socket().
struct GNUNET_TIME_Relative GNUNET_TIME_randomized_backoff | ( | struct GNUNET_TIME_Relative | rt, |
struct GNUNET_TIME_Relative | threshold | ||
) |
Randomized exponential back-off, starting at 1 ms and going up by a factor of 2+r, where 0 <= r <= 0.5, up to a maximum of the given threshold.
rt | current backoff time, initially zero |
threshold | maximum value for backoff |
Definition at line 834 of file time.c.
References GNUNET_TIME_relative_max(), GNUNET_TIME_relative_min(), GNUNET_TIME_relative_multiply_double(), GNUNET_TIME_UNIT_MILLISECONDS, and t.
Referenced by error_handler(), and validation_start_cb().
struct GNUNET_TIME_Relative GNUNET_TIME_randomize | ( | struct GNUNET_TIME_Relative | r | ) |
Return a random time value between 0.5*r and 1.5*r.
r | input time for scaling |
Definition at line 855 of file time.c.
References d, and GNUNET_TIME_relative_multiply_double().
Referenced by start_dv_learn().
struct GNUNET_TIME_Relative GNUNET_TIME_relative_get_zero_ | ( | void | ) |
Return relative time of 0ms.
Definition at line 133 of file time.c.
References zero.
Referenced by create_handle(), delayed_disconnect_channel(), solve_srv_room_member_collisions(), and verify_tunnel_message().
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get_zero_ | ( | void | ) |
Return absolute time of 0ms.
Definition at line 142 of file time.c.
References zero.
Referenced by create_operation(), GNUNET_GNSRECORD_block_get_expiration(), and stop_operation().
struct GNUNET_TIME_Relative GNUNET_TIME_relative_get_unit_ | ( | void | ) |
Return relative time of 1 microsecond.
struct GNUNET_TIME_Relative GNUNET_TIME_relative_get_millisecond_ | ( | void | ) |
Return relative time of 1ms.
struct GNUNET_TIME_Relative GNUNET_TIME_relative_get_second_ | ( | void | ) |
Return relative time of 1s.
Definition at line 169 of file time.c.
Referenced by login_cont(), and on_message().
struct GNUNET_TIME_Relative GNUNET_TIME_relative_get_minute_ | ( | void | ) |
Return relative time of 1 minute.
Definition at line 178 of file time.c.
Referenced by register_reciever().
struct GNUNET_TIME_Relative GNUNET_TIME_relative_get_hour_ | ( | void | ) |
struct GNUNET_TIME_Relative GNUNET_TIME_relative_get_forever_ | ( | void | ) |
Return "forever".
Definition at line 196 of file time.c.
Referenced by delete_srv_room_message().
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get_forever_ | ( | void | ) |
Return "forever".
Definition at line 205 of file time.c.
Referenced by cleanup_srv_room_discourse_messages().
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get | ( | void | ) |
Get the current time.
Definition at line 111 of file time.c.
References ret, and timestamp_offset.
Referenced by add_without_sets(), announce_id(), block_create_ecdsa(), block_create_eddsa(), block_decrypt_ecdsa(), block_decrypt_eddsa(), cache_nick(), check_vl_transmission(), cleanup_expired_records(), code_redirect(), consider_for_advertising(), consider_path_cb(), continue_store_activity(), cookie_identity_interpretation(), core_init(), create_download_context(), create_member_session(), cummulative_ack(), data_sent_cb(), dht_connect_cb(), expire_blocks(), expired_processor(), find_proof(), flush_bulk(), free_timedout_queue_entry(), GCC_handle_connection_create_ack(), GCC_handle_encrypted(), GCC_transmit(), GCP_set_hello(), GCT_add_inbound_connection(), GDS_ROUTING_add(), generate_id_token_body(), get_age(), get_any(), get_nick_record(), get_redirect_state(), get_timeout(), get_typed(), GNUNET_BANDWIDTH_tracker_init2(), GNUNET_CRYPTO_random_timeflake(), GNUNET_FS_meta_data_add_publication_date(), GNUNET_FS_publish_main_(), GNUNET_FS_queue_(), GNUNET_FS_search_probe_progress_(), GNUNET_FS_unindex_start(), GNUNET_GNSRECORD_normalize_record_set(), GNUNET_LOAD_update(), GNUNET_LOAD_value_init(), GNUNET_PEERSTORE_hello_add(), GNUNET_SCHEDULER_add_at_with_priority(), GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_add_select(), GNUNET_SCHEDULER_add_shutdown(), GNUNET_SCHEDULER_add_with_reason_and_priority(), GNUNET_SCHEDULER_do_work(), GNUNET_SCHEDULER_run(), GNUNET_TESTING_cmd_batch_next_(), GNUNET_TESTING_interpreter_current_cmd_touch(), GNUNET_TESTING_interpreter_next_(), GNUNET_TESTING_interpreter_run_cmd_(), GNUNET_TIME_absolute_get_duration(), GNUNET_TIME_absolute_get_monotonic(), GNUNET_TIME_absolute_get_remaining(), GNUNET_TIME_absolute_is_future(), GNUNET_TIME_absolute_is_past(), GNUNET_TIME_relative_to_absolute(), GNUNET_TIME_timestamp_get(), GNUNET_TIME_year_to_time(), GSC_KX_encrypt_and_transmit(), GSC_SESSIONS_set_typemap(), GSF_peer_transmit_(), GSF_pending_request_create_(), GSF_pending_request_get_message_(), handle_client_send_request(), handle_connection_create(), handle_delete_message(), handle_dht_local_get(), handle_dht_p2p_put(), handle_dht_reply(), handle_dummy(), handle_dv_learn(), handle_ephemeral_key(), handle_fragment_box(), handle_icmp_back(), handle_message_delete(), handle_monitor_next(), handle_p2p_estimate(), handle_p2p_put(), handle_stop(), handle_tcp_back(), handle_udp_back(), handler_advertisement(), insert_sorted(), iterate_zones(), lookup_authz_cb(), manage_first_hop_mq(), merge_with_nick_records(), monitor_cb(), monitor_notify_connect(), monitor_notify_disconnect(), monitor_unblock(), mylog(), namecache_postgres_expire_blocks(), namecache_sqlite_cache_block(), namecache_sqlite_expire_blocks(), notify_connect(), pack_srv_room_message(), peer_transmit(), postgres_plugin_del(), postgres_plugin_get(), postgres_plugin_get_closest(), postgres_plugin_get_expiration(), prepare_pending_acknowledgement(), printer(), printer_watch(), process_local_reply(), process_queue(), process_result(), process_stdin(), progress_cb(), queue_send_msg(), read_start_time(), read_stdio(), RECLAIM_TICKETS_consume(), reconnect(), remove_expired(), revalidation_start_cb(), route_message(), route_packet(), route_via_neighbour(), RPS_sampler_elem_reinit(), run(), run_iteration_round(), run_zone_iteration_round(), sampler_mod_get_rand_peer(), scan(), schedule_peer_transmission(), schedule_transmit_on_queue(), search_start(), select_best_pending_from_link(), send_kx(), send_kx_auth(), send_message_to_room(), send_simple_single(), service_client_mst_cb(), setup_estimate_message(), setup_job(), setup_state_record(), shutdown_task(), sign_ephemeral_key(), sign_pow_identity(), sqlite_plugin_del(), sqlite_plugin_get_closest(), sqlite_plugin_get_expiration(), start_dht_request(), start_download(), start_dv_learn(), start_job(), start_local_query(), start_operation(), start_process(), start_publish(), store_completed_cb(), store_skipped_key(), switch_member_session(), t_ax_encrypt(), test_exist_cb(), try_transmission(), update_ax_by_kx(), update_excess(), update_hostlist(), update_subscription_timing(), update_tracker(), and update_velocity().
struct GNUNET_TIME_Absolute GNUNET_TIME_relative_to_absolute | ( | struct GNUNET_TIME_Relative | rel | ) |
Convert relative time to an absolute time in the future.
rel | relative time to convert |
Definition at line 316 of file time.c.
References GNUNET_TIME_Absolute::abs_value_us, GNUNET_break, GNUNET_TIME_absolute_get(), GNUNET_TIME_relative_is_forever(), GNUNET_TIME_UNIT_FOREVER_ABS, and ret.
Referenced by add_setter_action(), add_without_sets(), boot_queue(), cadet_reply_proc(), check_for_glue(), core_read_finished_cb(), create_proto_queue(), create_receiver(), data_sent_cb(), do_dht_put(), download_hostlist(), forward_dv_box(), GNUNET_DNSPARSER_parse_record(), GNUNET_GNSRECORD_record_get_expiration_time(), GNUNET_HELLO_builder_to_block(), GNUNET_HELLO_builder_to_url2(), GNUNET_OS_command_run(), GNUNET_RESOLVER_hostname_get(), GNUNET_RESOLVER_ip_get(), GNUNET_SCHEDULER_add_delayed_with_priority(), GNUNET_SCHEDULER_add_select(), GNUNET_TIME_relative_to_timestamp(), GSC_SESSIONS_transmit(), GSF_pending_request_create_(), handle_client_call_message(), handle_dht_p2p_put(), handle_dht_reply(), handle_dv_box(), handle_dv_learn(), handle_find_my_hello(), handle_fragment_box(), handle_p2p_migration_stop(), handle_p2p_put(), handle_reliability_box(), handle_validation_response(), learn_dv_path(), login_cont(), maint_child_death(), make_file(), modify_address(), mq_init(), ns_lookup_result_cb(), plan(), print_record(), process_record(), process_result(), put_migration_continuation(), queue_read(), queue_read_kx(), queue_write(), regex_iterator(), reschedule_peer_timeout(), reschedule_queue_timeout(), reschedule_receiver_timeout(), reschedule_sender_timeout(), result_processor(), run(), schedule_next_hello(), send_create(), send_create_ack(), send_kx(), send_kx_auth(), setup_filter(), setup_out_cipher(), setup_queue(), setup_sender(), shc_cont(), sign_ephemeral_key(), start_address_validation(), transmit_on_queue(), transmit_request(), update_pm_next_attempt(), update_timeout(), validation_start_cb(), and vpn_allocation_cb().
struct GNUNET_TIME_Timestamp GNUNET_TIME_relative_to_timestamp | ( | struct GNUNET_TIME_Relative | rel | ) |
Convert relative time to a timestamp in the future.
rel | relative time to convert |
Definition at line 336 of file time.c.
References GNUNET_TIME_absolute_to_timestamp(), and GNUNET_TIME_relative_to_absolute().
struct GNUNET_TIME_Timestamp GNUNET_TIME_absolute_to_timestamp | ( | struct GNUNET_TIME_Absolute | at | ) |
Round an absolute time to a timestamp.
at | time to round |
Definition at line 79 of file time.c.
References GNUNET_TIME_Timestamp::abs_time, GNUNET_TIME_Absolute::abs_value_us, GNUNET_TIME_absolute_is_never(), and GNUNET_TIME_UNIT_FOREVER_TS.
Referenced by GNUNET_TIME_relative_to_timestamp(), and GNUNET_TIME_timestamp_get().
struct GNUNET_TIME_Timestamp GNUNET_TIME_timestamp_get | ( | void | ) |
Get timestamp representing the current time.
Definition at line 125 of file time.c.
References GNUNET_TIME_absolute_get(), and GNUNET_TIME_absolute_to_timestamp().
struct GNUNET_TIME_Relative GNUNET_TIME_relative_min | ( | struct GNUNET_TIME_Relative | t1, |
struct GNUNET_TIME_Relative | t2 | ||
) |
Return the minimum of two relative time values.
t1 | first timestamp |
t2 | other timestamp |
Definition at line 344 of file time.c.
Referenced by announce_id(), calculate_put_interval(), check_timeouts(), check_zone_namestore_next(), delayed_restart_task(), download_prepare(), encapsulate_for_dv(), find_advertisable_hello(), GNUNET_TIME_absolute_approx_eq(), GNUNET_TIME_randomized_backoff(), handle_validation_response(), process_job_queue(), put_migration_continuation(), reconnect(), route_control_message_without_fc(), route_via_neighbour(), schedule_next_put(), schedule_next_task(), and start_address_validation().
struct GNUNET_TIME_Relative GNUNET_TIME_relative_max | ( | struct GNUNET_TIME_Relative | t1, |
struct GNUNET_TIME_Relative | t2 | ||
) |
Return the maximum of two relative time values.
t1 | first timestamp |
t2 | other timestamp |
Definition at line 352 of file time.c.
Referenced by announce_id(), consider_gathering(), data_sent_cb(), do_scheduler_notify(), GNUNET_TIME_randomized_backoff(), put_migration_continuation(), reconnect(), schedule_next_task(), and send_keep_alive().
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_min | ( | struct GNUNET_TIME_Absolute | t1, |
struct GNUNET_TIME_Absolute | t2 | ||
) |
Return the minimum of two absolute time values.
t1 | first timestamp |
t2 | other timestamp |
Definition at line 360 of file time.c.
Referenced by cadet_reply_proc(), cummulative_ack(), GNUNET_GNSRECORD_record_get_expiration_time(), handle_dht_reply(), handle_p2p_put(), handle_validation_response(), ns_lookup_result_cb(), process_result(), and try_transmission().
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_max | ( | struct GNUNET_TIME_Absolute | t1, |
struct GNUNET_TIME_Absolute | t2 | ||
) |
Return the maximum of two absolute time values.
t1 | first timestamp |
t2 | other timestamp |
Definition at line 368 of file time.c.
Referenced by check_link_down(), GNUNET_GNSRECORD_record_get_expiration_time(), GNUNET_TIME_absolute_get_monotonic(), handle_add_queue_message(), handle_dht_result(), handle_flow_control(), learn_dv_path(), neighbour_dv_monotime_cb(), put_cb(), and update_iterator().
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_round_down | ( | struct GNUNET_TIME_Absolute | at, |
struct GNUNET_TIME_Relative | rt | ||
) |
Round down absolute time at to multiple of rt.
at | absolute time to round |
rt | multiple to round to (non-zero) |
Definition at line 392 of file time.c.
References GNUNET_assert, GNUNET_TIME_relative_is_zero(), and ret.
struct GNUNET_TIME_Timestamp GNUNET_TIME_timestamp_max | ( | struct GNUNET_TIME_Timestamp | t1, |
struct GNUNET_TIME_Timestamp | t2 | ||
) |
Return the maximum of two timestamps.
t1 | first timestamp |
t2 | other timestamp |
struct GNUNET_TIME_Timestamp GNUNET_TIME_timestamp_min | ( | struct GNUNET_TIME_Timestamp | t1, |
struct GNUNET_TIME_Timestamp | t2 | ||
) |
Return the minimum of two timestamps.
t1 | first timestamp |
t2 | other timestamp |
struct GNUNET_TIME_Relative GNUNET_TIME_absolute_get_remaining | ( | struct GNUNET_TIME_Absolute | future | ) |
Given a timestamp in the future, how much time remains until then?
future | some absolute time, typically in the future |
Definition at line 406 of file time.c.
References GNUNET_TIME_Absolute::abs_value_us, GNUNET_TIME_absolute_get(), GNUNET_TIME_absolute_is_never(), GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_TIME_UNIT_ZERO, and ret.
Referenced by add_record(), announce_id(), backtalker_timeout_cb(), check_for_glue(), check_link_down(), check_timeouts(), cmd_read(), connection_ready_cb(), consider_peer_destroy(), core_read_finished_cb(), data_sent_cb(), delayed_restart_task(), display_record(), do_dht_put(), download_prepare(), encapsulate_for_dv(), find_advertisable_hello(), get_transmit_delay(), GNUNET_DATASTORE_put(), GNUNET_GNSRECORD_check_pow(), GNUNET_GNSRECORD_is_expired(), GNUNET_SCHEDULER_add_at_with_priority(), GSF_block_peer_migration_(), handle_add_queue_message(), handle_cadet_ring_message(), handle_dht_response(), handle_encrypted(), handle_flow_control(), handle_namecache_block_response(), learn_dv_path(), list_callback(), load_operation(), monitor_cb(), path_cleanup_cb(), pick_random_dv_hops(), plan(), print_plugin_event_info(), process_job_queue(), process_lookup_result(), process_migration_content(), process_queue(), process_record(), proto_read_kx(), put_migration_continuation(), queue_read(), queue_read_kx(), queue_timeout(), queue_write(), quota_processor(), reassembly_cleanup_task(), revive_migration(), schedule_next_hello(), schedule_peer_transmission(), select_best_pending_from_link(), select_loop(), send_keep_alive(), sqlite_plugin_put(), t_ax_encrypt(), task_download(), timeout_cb(), transmit_item(), try_transmission(), update_flood_message(), update_pm_next_attempt(), and validation_start_cb().
bool GNUNET_TIME_absolute_approx_eq | ( | struct GNUNET_TIME_Absolute | a1, |
struct GNUNET_TIME_Absolute | a2, | ||
struct GNUNET_TIME_Relative | t | ||
) |
Test if a1 and a2 are equal within a margin of error of t.
a1 | time to compare |
a2 | time to compare |
t | tolerance to apply |
Definition at line 63 of file time.c.
References delta, GNUNET_TIME_absolute_get_difference(), GNUNET_TIME_relative_cmp, GNUNET_TIME_relative_min(), and t.
struct GNUNET_TIME_Relative GNUNET_TIME_calculate_eta | ( | struct GNUNET_TIME_Absolute | start, |
uint64_t | finished, | ||
uint64_t | total | ||
) |
Calculate the estimate time of arrival/completion for an operation.
start | when did the operation start? |
finished | how much has been done? |
total | how much must be done overall (same unit as for "finished") |
Definition at line 566 of file time.c.
References finished, GNUNET_break, GNUNET_TIME_absolute_get_duration(), GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_TIME_UNIT_ZERO, GNUNET_TIME_Relative::rel_value_us, ret, and start.
Referenced by GNUNET_FS_download_make_status_(), GNUNET_FS_publish_make_status_(), GNUNET_FS_unindex_make_status_(), and progress_proc().
struct GNUNET_TIME_Relative GNUNET_TIME_absolute_get_difference | ( | struct GNUNET_TIME_Absolute | start, |
struct GNUNET_TIME_Absolute | end | ||
) |
Compute the time difference between the given start and end times.
Use this function instead of actual subtraction to ensure that "FOREVER" and overflows are handled correctly.
start | some absolute time |
end | some absolute time (typically larger or equal to start) |
Definition at line 423 of file time.c.
References end, GNUNET_TIME_absolute_is_never(), GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_TIME_UNIT_ZERO, ret, and start.
Referenced by expire_blocks(), expired_processor(), free_timedout_queue_entry(), GNUNET_TIME_absolute_approx_eq(), handle_client_join(), handle_delete_message(), handle_message_delete(), sampler_mod_get_rand_peer(), solve_srv_room_member_collisions(), stat_cmd(), update_subscription_timing(), update_timeout(), and verify_tunnel_message().
struct GNUNET_TIME_Relative GNUNET_TIME_absolute_get_duration | ( | struct GNUNET_TIME_Absolute | whence | ) |
Get the duration of an operation as the difference of the current time and the given start time "hence".
whence | some absolute time, typically in the past |
Definition at line 438 of file time.c.
References GNUNET_TIME_Absolute::abs_value_us, GNUNET_TIME_absolute_get(), GNUNET_TIME_UNIT_ZERO, and ret.
Referenced by consider_sending_fc(), disconnect_and_schedule_reconnect(), do_shutdown(), evaluate_connection(), find_proof(), flush_bulk(), forward_dv_learn(), get_network_latency(), GNUNET_BANDWIDTH_tracker_get_available(), GNUNET_CURL_perform2(), GNUNET_FS_download_make_status_(), GNUNET_FS_publish_make_status_(), GNUNET_FS_search_make_status_(), GNUNET_FS_search_probe_progress_(), GNUNET_FS_unindex_make_status_(), GNUNET_SCHEDULER_do_work(), GNUNET_TESTING_interpreter_next_(), GNUNET_TIME_calculate_eta(), GSC_CLIENTS_solicit_request(), GSF_peer_update_performance_(), GSF_update_datastore_delay_(), handle_acknowledged(), handle_client_send(), handle_data(), handle_dht_p2p_put(), handle_encrypted(), handle_fragment_box(), handle_matching_ack(), handle_result(), handle_validation_response(), hello_iter(), internal_update(), lookup_authz_cb(), maint_child_death(), mylog(), namecache_sqlite_cache_block(), notify_client_chk_update(), odc_warn_delay_task(), peer_transmit(), process_parallel_lookup_result(), process_queue(), process_reply(), process_result(), process_result_with_request(), process_stdin(), progress_cb(), put_migration_continuation(), regex_found_handler(), run(), run_iteration_round(), run_zone_iteration_round(), schedule_next_task(), shutdown_task(), signal_probe_result(), stop_job(), store_completed_cb(), test_master(), transmit_cummulative_ack_cb(), update_velocity(), warn_delay_task(), warn_no_client_continue(), and write_start_time().
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_add | ( | struct GNUNET_TIME_Absolute | start, |
struct GNUNET_TIME_Relative | duration | ||
) |
Add a given relative duration to the given start time.
start | some absolute time |
duration | some relative time to add |
Definition at line 452 of file time.c.
References duration, GNUNET_break, GNUNET_TIME_absolute_is_never(), GNUNET_TIME_relative_is_forever(), GNUNET_TIME_UNIT_FOREVER_ABS, GNUNET_TIME_Relative::rel_value_us, ret, and start.
Referenced by announce_id(), block_create_ecdsa(), block_create_eddsa(), core_init(), create_subscription(), generate_id_token_body(), get_transmit_delay(), GNUNET_GNSRECORD_check_pow(), handle_delete_message(), handle_ephemeral_key(), handle_message_delete(), process_job_queue(), process_queue(), sign_ephemeral(), start_operation(), t_ax_encrypt(), timeout_cb(), update_ax_by_kx(), update_flood_message(), update_next_challenge_time(), and update_subscription().
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_subtract | ( | struct GNUNET_TIME_Absolute | start, |
struct GNUNET_TIME_Relative | duration | ||
) |
Subtract a given relative duration from the given start time.
start | some absolute time |
duration | some relative time to subtract |
Definition at line 471 of file time.c.
References duration, GNUNET_TIME_absolute_is_never(), GNUNET_TIME_UNIT_FOREVER_ABS, GNUNET_TIME_UNIT_ZERO_ABS, GNUNET_TIME_Relative::rel_value_us, ret, and start.
Referenced by GSF_pending_request_create_(), handle_ephemeral_key(), handle_validation_response(), read_start_time(), and sign_pow_identity().
struct GNUNET_TIME_Relative GNUNET_TIME_relative_multiply_double | ( | struct GNUNET_TIME_Relative | rel, |
double | factor | ||
) |
Multiply relative time by a given factor.
rel | some duration |
factor | double to multiply with |
Definition at line 506 of file time.c.
References GNUNET_assert, GNUNET_break, GNUNET_TIME_relative_is_forever(), GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_TIME_UNIT_ZERO, m, and GNUNET_TIME_Relative::rel_value_us.
Referenced by GNUNET_TIME_randomize(), GNUNET_TIME_randomized_backoff(), handle_discourse_subscription(), and update_pm_next_attempt().
struct GNUNET_TIME_Relative GNUNET_TIME_relative_multiply | ( | struct GNUNET_TIME_Relative | rel, |
unsigned long long | factor | ||
) |
Multiply relative time by a given factor.
rel | some duration |
factor | integer to multiply with |
Definition at line 486 of file time.c.
References GNUNET_break, GNUNET_TIME_relative_is_forever(), GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_TIME_UNIT_ZERO, and ret.
Referenced by announce_next_regex(), calculate_rtt(), check_zone_namestore_next(), cleanup_expired_records(), connection_create(), connection_update_timer(), consider_gathering(), context_task(), curl_download_prepare(), download_prepare(), expire_records_continuation(), get_randomized_delay(), GNUNET_DNSPARSER_parse_record(), GNUNET_GNSRECORD_check_pow(), GNUNET_GNSRECORD_pow_start(), GNUNET_RPS_sub_start(), GNUNET_STATISTICS_destroy(), GSF_pending_request_create_(), handle_connection_create(), handle_dht_p2p_put(), handle_dv_learn(), handle_fragment_box(), handle_p2p_put(), handle_validation_response(), helper_read(), helper_write(), iter_finished(), login_cont(), lookup_authz_cb(), main(), plan(), process_job_queue(), read_send(), reannounce_regex(), reconnect(), register_sender(), REST_gns_process_request(), run(), run_httpd(), run_with_key(), schedule_next_put(), send_find_peer_message(), start_burst(), start_closing_period(), start_draining_period(), start_dv_learn(), start_helper(), stream_start_response(), task_check(), test_master(), timeout_cb(), and transmit_on_queue().
struct GNUNET_TIME_Relative GNUNET_TIME_relative_saturating_multiply | ( | struct GNUNET_TIME_Relative | rel, |
unsigned long long | factor | ||
) |
Saturating multiply relative time by a given factor.
rel | some duration |
factor | integer to multiply with |
Definition at line 533 of file time.c.
References GNUNET_TIME_relative_is_forever(), GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_TIME_UNIT_ZERO, and ret.
Referenced by compute_rand_delay(), daemon_started(), GNUNET_FS_search_start_probe_(), GNUNET_is_burst_ready(), process_job_queue(), put_migration_continuation(), reconnect(), schedule_next_task(), and update_excess().
struct GNUNET_TIME_Relative GNUNET_TIME_relative_divide | ( | struct GNUNET_TIME_Relative | rel, |
unsigned long long | factor | ||
) |
Divide relative time by a given factor.
rel | some duration |
factor | integer to divide by |
Definition at line 552 of file time.c.
References GNUNET_TIME_relative_is_forever(), GNUNET_TIME_UNIT_FOREVER_REL, and ret.
Referenced by calculate_put_interval(), compute_rand_delay(), consider_gathering(), do_shutdown(), find_proof(), get_network_latency(), GNUNET_GNSRECORD_check_pow(), handle_dht_p2p_put(), handle_reliability_box(), peerstore_store_own_cb(), run_iteration_round(), run_zone_iteration_round(), schedule_next_put(), send_keep_alive(), start_address_validation(), store_completed_cb(), update_pm_next_attempt(), and update_timeout().
struct GNUNET_TIME_Relative GNUNET_TIME_relative_add | ( | struct GNUNET_TIME_Relative | a1, |
struct GNUNET_TIME_Relative | a2 | ||
) |
Add relative times together.
a1 | some relative time |
a2 | some other relative time |
Definition at line 587 of file time.c.
References GNUNET_break, GNUNET_TIME_UNIT_FOREVER_REL, and ret.
Referenced by calculate_rtt(), compute_rand_delay(), forward_dv_learn(), handle_dht_p2p_put(), process_queue(), process_result(), run(), sign_ephemeral_key(), stat_cmd(), stop_job(), store_completed_cb(), update_pm_next_attempt(), and update_velocity().
struct GNUNET_TIME_Relative GNUNET_TIME_relative_subtract | ( | struct GNUNET_TIME_Relative | a1, |
struct GNUNET_TIME_Relative | a2 | ||
) |
Subtract relative timestamp from the other.
a1 | first timestamp |
a2 | second timestamp |
Definition at line 605 of file time.c.
References GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_TIME_UNIT_ZERO, and ret.
Referenced by check_zone_namestore_next(), get_network_latency(), GNUNET_FS_search_probe_progress_(), GNUNET_is_burst_ready(), handle_acknowledged(), learn_dv_path(), store_completed_cb(), and update_velocity().
struct GNUNET_TIME_RelativeNBO GNUNET_TIME_relative_hton | ( | struct GNUNET_TIME_Relative | a | ) |
Convert relative time to network byte order.
a | time to convert |
Definition at line 620 of file time.c.
References GNUNET_htonll(), and ret.
Referenced by announce_reconnect(), consider_sending_fc(), create_message_delete(), create_message_subscribe(), forward_dv_learn(), GNUNET_get_burst_sync_msg(), GNUNET_GNSRECORD_pow_start(), GNUNET_RPS_sub_start(), GNUNET_TRANSPORT_communicator_receive(), GSF_block_peer_migration_(), notify_monitor(), on_message(), send_add_address(), start_burst(), start_dv_learn(), and transmit_cummulative_ack_cb().
struct GNUNET_TIME_Relative GNUNET_TIME_relative_ntoh | ( | struct GNUNET_TIME_RelativeNBO | a | ) |
Convert relative time from network byte order.
a | time to convert |
Definition at line 630 of file time.c.
References GNUNET_ntohll(), and ret.
Referenced by forward_dv_learn(), get_network_latency(), GNUNET_is_burst_ready(), GNUNET_JSON_pack_time_rel_nbo(), handle_add_address(), handle_announce(), handle_client_start_sub(), handle_delete_message(), handle_discourse_subscription(), handle_flow_control(), handle_message_delete(), handle_message_subscribe(), handle_monitor_data(), handle_p2p_migration_stop(), handle_reliability_ack(), handle_start_burst(), and handle_validation_response().
struct GNUNET_TIME_AbsoluteNBO GNUNET_TIME_absolute_hton | ( | struct GNUNET_TIME_Absolute | a | ) |
Convert absolute time to network byte order.
a | time to convert |
Definition at line 640 of file time.c.
References GNUNET_htonll(), and ret.
Referenced by block_create_ecdsa(), block_create_eddsa(), client_response_handler(), consider_sending_fc(), create_loc_uri(), do_dht_put(), encapsulate_for_dv(), extract_abs_time_nbo(), forward_reply(), GDS_helper_make_put_message(), GDS_helper_sign_path(), GDS_NEIGHBOURS_handle_reply(), get_cb(), GNUNET_CONSENSUS_create(), GNUNET_DATASTORE_put(), GNUNET_DHT_put(), GNUNET_DHT_verify_path(), GNUNET_FS_uri_loc_create(), GNUNET_HELLO_builder_to_block(), GNUNET_HELLO_parser_to_block(), GNUNET_HELLO_sign_address(), GNUNET_SECRETSHARING_create_session(), GNUNET_SECRETSHARING_decrypt(), GNUNET_TIME_absolute_get_monotonic(), GNUNET_TIME_timestamp_hton(), GSC_KX_encrypt_and_transmit(), GSC_KX_handle_client_monitor_peers(), handle_client_call_message(), handle_client_loc_sign(), handle_datastore_reply(), handle_list(), handle_lookup_block_it(), handle_p2p_reply(), inject_rekey(), monitor_notify_all(), notify_monitor(), pack_srv_room_message(), PEERSTORE_create_record_mq_envelope(), put_action(), regex_iterator(), response_action(), run_edkey(), run_pkey(), send_challenge(), send_create(), send_lookup_response_with_filter(), send_message_to_room(), send_msg_with_kx(), send_request(), send_simple_single(), setup_estimate_message(), setup_flood_message(), sign_ephemeral(), sign_ephemeral_key(), sign_hello(), sign_pow_identity(), start_dv_learn(), transmit_content(), transmit_item(), transmit_kx(), transmit_status(), update_backtalker_monotime(), uri_loc_parse(), validation_transmit_on_queue(), and verify_hello().
struct GNUNET_TIME_TimestampNBO GNUNET_TIME_timestamp_hton | ( | struct GNUNET_TIME_Timestamp | t | ) |
Convert timestamp to network byte order.
t | time to convert |
Definition at line 91 of file time.c.
References GNUNET_TIME_TimestampNBO::abs_time_nbo, GNUNET_TIME_absolute_hton(), and t.
Referenced by extract_timestamp_nbo(), and parse_timestamp_nbo().
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_from_ms | ( | uint64_t | ms_after_epoch | ) |
Convert milliseconds after the UNIX epoch to absolute time.
ms_after_epoch | millisecond timestamp to convert |
Definition at line 691 of file time.c.
References GNUNET_TIME_UNIT_FOREVER_ABS, GNUNET_TIME_UNIT_MILLISECONDS, and ret.
bool GNUNET_TIME_absolute_is_never | ( | struct GNUNET_TIME_Absolute | abs | ) |
Test if abs is never.
Definition at line 650 of file time.c.
References GNUNET_TIME_Absolute::abs_value_us, and GNUNET_TIME_UNIT_FOREVER_ABS.
Referenced by GNUNET_JSON_from_timestamp(), GNUNET_STRINGS_absolute_time_to_string(), GNUNET_STRINGS_fancy_time_to_timestamp(), GNUNET_TIME_absolute2s(), GNUNET_TIME_absolute_add(), GNUNET_TIME_absolute_get_difference(), GNUNET_TIME_absolute_get_remaining(), GNUNET_TIME_absolute_subtract(), GNUNET_TIME_absolute_to_timestamp(), GNUNET_TIME_timestamp2s(), and GNUNET_TIME_timestamp_to_s().
bool GNUNET_TIME_absolute_is_past | ( | struct GNUNET_TIME_Absolute | abs | ) |
Test if abs is truly in the past (excluding now).
Definition at line 671 of file time.c.
References GNUNET_TIME_Absolute::abs_value_us, and GNUNET_TIME_absolute_get().
Referenced by block_plugin_dns_check_block(), block_plugin_regex_check_block(), datacache_get_iterator(), get_cb(), handle_dht_p2p_put(), handle_dht_p2p_result(), handle_find_local_hello(), transmit_next_request_task(), and verify_hello().
bool GNUNET_TIME_absolute_is_zero | ( | struct GNUNET_TIME_Absolute | abs | ) |
Test if abs is truly zero.
Definition at line 848 of file time.c.
References GNUNET_TIME_Absolute::abs_value_us.
Referenced by GNUNET_JSON_pack_timestamp().
bool GNUNET_TIME_absolute_is_future | ( | struct GNUNET_TIME_Absolute | abs | ) |
Test if abs is truly in the future (excluding now).
Definition at line 681 of file time.c.
References GNUNET_TIME_Absolute::abs_value_us, and GNUNET_TIME_absolute_get().
bool GNUNET_TIME_relative_is_forever | ( | struct GNUNET_TIME_Relative | rel | ) |
Test if rel is forever.
Definition at line 657 of file time.c.
References GNUNET_TIME_UNIT_FOREVER_REL, and GNUNET_TIME_Relative::rel_value_us.
Referenced by GNUNET_JSON_from_time_rel(), GNUNET_TIME_absolute_add(), GNUNET_TIME_relative2s(), GNUNET_TIME_relative_divide(), GNUNET_TIME_relative_multiply(), GNUNET_TIME_relative_multiply_double(), GNUNET_TIME_relative_saturating_multiply(), and GNUNET_TIME_relative_to_absolute().
bool GNUNET_TIME_relative_is_zero | ( | struct GNUNET_TIME_Relative | rel | ) |
Test if rel is zero.
Definition at line 664 of file time.c.
References GNUNET_TIME_Relative::rel_value_us.
Referenced by GNUNET_TIME_absolute_round_down().
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_from_s | ( | uint64_t | s_after_epoch | ) |
Convert seconds after the UNIX epoch to absolute time.
s_after_epoch | seconds after epoch to convert |
Definition at line 705 of file time.c.
References GNUNET_TIME_UNIT_FOREVER_ABS, GNUNET_TIME_UNIT_SECONDS, and ret.
struct GNUNET_TIME_Timestamp GNUNET_TIME_timestamp_from_s | ( | uint64_t | s_after_epoch | ) |
Convert seconds after the UNIX epoch to timestamp.
s_after_epoch | seconds after epoch to convert |
Definition at line 718 of file time.c.
References GNUNET_TIME_UNIT_FOREVER_TS, GNUNET_TIME_UNIT_SECONDS, and ret.
uint64_t GNUNET_TIME_timestamp_to_s | ( | struct GNUNET_TIME_Timestamp | ts | ) |
Convert timestamp to number of seconds after the UNIX epoch.
ts | timestamp to convert |
Definition at line 732 of file time.c.
References GNUNET_TIME_Timestamp::abs_time, GNUNET_TIME_Absolute::abs_value_us, GNUNET_TIME_absolute_is_never(), and GNUNET_TIME_UNIT_SECONDS.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_ntoh | ( | struct GNUNET_TIME_AbsoluteNBO | a | ) |
Convert absolute time from network byte order.
a | time to convert |
Definition at line 741 of file time.c.
References GNUNET_ntohll(), and ret.
Referenced by backtalker_monotime_cb(), bind_nbotime(), block_plugin_dns_check_block(), block_plugin_regex_check_block(), do_dht_put(), do_rekey(), GCP_check_and_update_monotime(), get_network_latency(), GNUNET_GNSRECORD_block_get_expiration(), GNUNET_GNSRECORD_check_pow(), GNUNET_HELLO_dht_msg_to_block(), GNUNET_HELLO_get_expiration_time_from_msg(), GNUNET_HELLO_parser_from_block(), GNUNET_TIME_absolute_get_monotonic(), GNUNET_TIME_timestamp_ntoh(), handle_arm_list_result(), handle_cadet_ring_message(), handle_client_decrypt(), handle_client_join(), handle_client_keygen(), handle_client_loc_sign(), handle_client_redirect_to_ip(), handle_client_redirect_to_service(), handle_client_send_request(), handle_data(), handle_delete_message(), handle_dht_local_put(), handle_dht_p2p_put(), handle_dht_p2p_result(), handle_dht_result(), handle_dv_box(), handle_dv_learn(), handle_encrypted(), handle_ephemeral_key(), handle_estimate(), handle_flow_control(), handle_lookup_block_response(), handle_message_delete(), handle_message_id(), handle_message_join(), handle_message_subscribe(), handle_monitor_data(), handle_monitor_get_resp(), handle_monitor_put(), handle_p2p_estimate(), handle_p2p_put(), handle_put(), handle_receive_info(), handle_record_result(), handle_reply(), handle_result(), handle_signature_response(), handle_status(), handle_validation_response(), handshake_ack_monotime_cb(), handshake_monotime_cb(), inject_rekey(), iterate_flag_for_cleanup_discourse_message(), neighbour_dv_monotime_cb(), notify_srv_handle_message(), PEERSTORE_parse_record_message(), process_client_result(), put_cb(), rekey_monotime_cb(), run(), transmit_task_cb(), update_flood_message(), and verify_tunnel_message().
struct GNUNET_TIME_Timestamp GNUNET_TIME_timestamp_ntoh | ( | struct GNUNET_TIME_TimestampNBO | tn | ) |
Convert timestamp from network byte order.
tn | time to convert |
Definition at line 101 of file time.c.
References GNUNET_TIME_absolute_ntoh(), and t.
Referenced by GNUNET_JSON_from_timestamp_nbo(), and GNUNET_JSON_pack_timestamp_nbo().
void GNUNET_TIME_set_offset | ( | long long | offset | ) |
Set the timestamp offset for this instance.
offset | the offset to skew the locale time by |
Definition at line 49 of file time.c.
References timestamp_offset.
Referenced by do_speedup(), GNUNET_PROGRAM_run2(), GNUNET_SERVICE_run_(), and set_timetravel_time().
long long GNUNET_TIME_get_offset | ( | void | ) |
Get the timestamp offset for this instance.
Definition at line 56 of file time.c.
References timestamp_offset.
Referenced by mylog().
unsigned int GNUNET_TIME_get_current_year | ( | void | ) |
struct GNUNET_TIME_Absolute GNUNET_TIME_year_to_time | ( | unsigned int | year | ) |
Convert a year to an expiration time of January 1st of that year.
year | a year (after 1970, please ;-)). |
Definition at line 805 of file time.c.
References GNUNET_break, GNUNET_TIME_absolute_get(), my_timegm(), ret, and t.
Referenced by main().
unsigned int GNUNET_TIME_time_to_year | ( | struct GNUNET_TIME_Absolute | at | ) |
Convert an expiration time to the respective year (rounds)
at | absolute time |
Definition at line 765 of file time.c.
References GNUNET_TIME_Absolute::abs_value_us, and t.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get_monotonic | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg | ) |
Obtain the current time and make sure it is monotonically increasing.
Guards against systems without an RTC or clocks running backwards and other nasty surprises. Does not guarantee that the returned time is near the current time returned by GNUNET_TIME_absolute_get(). Two subsequent calls (within a short time period) may return the same value. Persists the last returned time on disk to ensure that time never goes backwards. As a result, the resulting value can be used to check if a message is the "most recent" value and replays of older messages (from the same origin) would be discarded.
cfg | configuration, used to determine where to store the time; user can also insist RTC is working nicely and disable the feature |
Definition at line 864 of file time.c.
References _, GNUNET_TIME_Absolute::abs_value_us, GNUNET_TIME_AbsoluteNBO::abs_value_us__, ATOMIC, cfg, filename, GNUNET_break, GNUNET_CONFIGURATION_get_value_filename(), GNUNET_DISK_file_close(), GNUNET_DISK_file_handle_size(), GNUNET_DISK_file_map(), GNUNET_DISK_file_open(), GNUNET_DISK_file_unmap(), GNUNET_DISK_file_write(), GNUNET_DISK_MAP_TYPE_READWRITE, GNUNET_DISK_OPEN_CREATE, GNUNET_DISK_OPEN_READWRITE, GNUNET_DISK_PERM_GROUP_READ, GNUNET_DISK_PERM_GROUP_WRITE, GNUNET_DISK_PERM_USER_READ, GNUNET_DISK_PERM_USER_WRITE, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_log, GNUNET_OK, GNUNET_TIME_absolute_get(), GNUNET_TIME_absolute_hton(), GNUNET_TIME_absolute_max(), GNUNET_TIME_absolute_ntoh(), map, and size.
Referenced by __attribute__(), consider_sending_fc(), handle_validation_response(), inject_rekey(), run(), send_challenge(), send_create(), send_msg_with_kx(), sign_ephemeral(), start_address_validation(), start_dv_learn(), transmit_kx(), validation_start_cb(), and validation_transmit_on_queue().