GNUnet  0.10.x
Data Structures | Macros | Functions
gnunet_time_lib.h File Reference
#include "gnunet_common.h"
Include dependency graph for gnunet_time_lib.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  GNUNET_TIME_Absolute
 Time for absolute times used by GNUnet, in microseconds. 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...
 

Macros

#define GNUNET_TIME_UNIT_ZERO   GNUNET_TIME_relative_get_zero_()
 Relative time zero. More...
 
#define GNUNET_TIME_UNIT_ZERO_ABS   GNUNET_TIME_absolute_get_zero_()
 Absolute time 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   GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_HOURS, 24)
 One day. More...
 
#define GNUNET_TIME_UNIT_WEEKS   GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_DAYS, 7)
 One week. More...
 
#define GNUNET_TIME_UNIT_MONTHS   GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_DAYS, 30)
 One month (30 days). More...
 
#define GNUNET_TIME_UNIT_YEARS   GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_DAYS, 365)
 One year (365 days). More...
 
#define GNUNET_TIME_UNIT_FOREVER_REL   GNUNET_TIME_relative_get_forever_ ()
 Constant used to specify "forever". More...
 
#define GNUNET_TIME_UNIT_FOREVER_ABS   GNUNET_TIME_absolute_get_forever_ ()
 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...
 

Functions

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...
 
int GNUNET_TIME_round_abs (struct GNUNET_TIME_Absolute *at)
 Round a time value so that it is suitable for transmission via JSON encodings. More...
 
int GNUNET_TIME_round_rel (struct GNUNET_TIME_Relative *rt)
 Round a time value so that it is suitable for transmission via JSON encodings. 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_Relative GNUNET_TIME_absolute_get_remaining (struct GNUNET_TIME_Absolute future)
 Given a timestamp in the future, how much time remains until then? 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 (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_Absolute GNUNET_TIME_absolute_ntoh (struct GNUNET_TIME_AbsoluteNBO a)
 Convert absolute time 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 (i.e. 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...
 

Detailed Description

Author
Christian Grothoff

Functions related to time

Definition in file gnunet_time_lib.h.