Data Structures | Typedefs | Functions
duration.h File Reference

Go to the source code of this file.

Data Structures

struct  ldns_duration_struct

Typedefs

typedef struct ldns_duration_struct ldns_duration_type
 This file is copied from the OpenDNSSEC source repository and only slightly adapted to make it fit.

Functions

ldns_duration_typeldns_duration_create (void)
 Create a new 'instant' duration.
int ldns_duration_compare (ldns_duration_type *d1, ldns_duration_type *d2)
 Compare durations.
ldns_duration_typeldns_duration_create_from_string (const char *str)
 Create a duration from string.
char * ldns_duration2string (ldns_duration_type *duration)
 Convert a duration to a string.
time_t ldns_duration2time (ldns_duration_type *duration)
 Convert a duration to a time.
void ldns_duration_cleanup (ldns_duration_type *duration)
 Clean up duration.

Typedef Documentation

This file is copied from the OpenDNSSEC source repository and only slightly adapted to make it fit.

Durations. Duration.

Definition at line 54 of file duration.h.


Function Documentation

Create a new 'instant' duration.

Returns:
ldns_duration_type* created duration

Create a new 'instant' duration.

Durations. Create a new 'instant' duration.

Definition at line 54 of file duration.c.

References ldns_duration_struct::days, ldns_duration_struct::hours, malloc, ldns_duration_struct::minutes, ldns_duration_struct::months, ldns_duration_struct::seconds, ldns_duration_struct::weeks, and ldns_duration_struct::years.

Compare durations.

Parameters:
[in]d1one duration
[in]d2another duration
Returns:
int 0 if equal, -1 if d1 < d2, 1 if d2 < d1

Definition at line 78 of file duration.c.

References ldns_duration_struct::days, ldns_duration_struct::hours, ldns_duration_struct::minutes, ldns_duration_struct::months, ldns_duration_struct::seconds, ldns_duration_struct::weeks, and ldns_duration_struct::years.

Create a duration from string.

Parameters:
[in]strstring-format duration
Returns:
ldns_duration_type* created duration

Definition at line 118 of file duration.c.

References ldns_duration_struct::days, ldns_duration_struct::hours, ldns_duration_cleanup(), ldns_duration_create(), ldns_duration_struct::minutes, ldns_duration_struct::months, ldns_duration_struct::seconds, ldns_duration_struct::weeks, and ldns_duration_struct::years.

Convert a duration to a string.

Parameters:
[in]durationduration to be converted
Returns:
char* string-format duration

Definition at line 216 of file duration.c.

References ldns_duration_struct::days, ldns_duration_struct::hours, ldns_duration_struct::minutes, ldns_duration_struct::months, ldns_duration_struct::seconds, ldns_duration_struct::weeks, and ldns_duration_struct::years.

time_t ldns_duration2time ( ldns_duration_type duration)

Convert a duration to a time.

Parameters:
[in]durationduration to be converted
Returns:
time_t time-format duration

Definition at line 319 of file duration.c.

References ldns_duration_struct::days, ldns_duration_struct::hours, ldns_duration_struct::minutes, ldns_duration_struct::months, ldns_duration_struct::seconds, ldns_duration_struct::weeks, and ldns_duration_struct::years.

Clean up duration.

Parameters:
[in]durationduration to be cleaned up

Definition at line 347 of file duration.c.