ldns(3) Library Functions Manual ldns(3)

# [NAME](#NAME)

ldns\_duration\_type, ldns\_duration\_create, ldns\_duration\_create\_from\_string, ldns\_duration\_cleanup, ldns\_duration\_compare, ldns\_duration2string, ldns\_duration2time - duration type and related functions

# [SYNOPSIS](#SYNOPSIS)

#include &lt;stdint.h&gt;  
#include &lt;stdbool.h&gt;

#include &lt;ldns/ldns.h&gt;

ldns\_duration\_type* ldns\_duration\_create(void);

ldns\_duration\_type* ldns\_duration\_create\_from\_string(const char* str);

void ldns\_duration\_cleanup(ldns\_duration\_type* duration);

int ldns\_duration\_compare(const ldns\_duration\_type* d1, const ldns\_duration\_type* d2);

char* ldns\_duration2string(const ldns\_duration\_type* duration);

time\_t ldns\_duration2time(const ldns\_duration\_type* duration);

# [DESCRIPTION](#DESCRIPTION)

*ldns\_duration\_type*  
Duration.

struct ldns\_duration\_struct  
{  
time\_t years;  
time\_t months;  
time\_t weeks;  
time\_t days;  
time\_t hours;  
time\_t minutes;  
time\_t seconds;  
};

typedef struct ldns\_duration\_struct ldns\_duration\_type;

*ldns\_duration\_create*() Create a new 'instant' duration.  
Returns ldns\_duration\_type* created duration

*ldns\_duration\_create\_from\_string*() Create a duration from string.  
**str**: string-format duration  
Returns ldns\_duration\_type* created duration

*ldns\_duration\_cleanup*() Clean up duration.  
**duration**: duration to be cleaned up

*ldns\_duration\_compare*() Compare durations.  
**d1**: one duration  
**d2**: another duration  
Returns int 0 if equal, -1 if d1 &lt; d2, 1 if d2 &lt; d1

*ldns\_duration2string*() Convert a duration to a string.  
**duration**: duration to be converted  
Returns char* string-format duration

*ldns\_duration2time*() Convert a duration to a time.  
**duration**: duration to be converted  
Returns time\_t time-format duration

# [AUTHOR](#AUTHOR)

The ldns team at NLnet Labs.

# [REPORTING BUGS](#REPORTING_BUGS)

Please report bugs to dns-team@nlnetlabs.nl or on GitHub at https://github.com/NLnetLabs/ldns/issues

# [COPYRIGHT](#COPYRIGHT)

Copyright (c) 2004 - 2006 NLnet Labs.

Licensed under the BSD License. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

# [SEE ALSO](#SEE_ALSO)

**perldoc Net::DNS**, **RFC1034**, **RFC1035**, **RFC4033**, **RFC4034** and **RFC4035**.

# [REMARKS](#REMARKS)

This manpage was automatically generated from the ldns source code.

30 May 2006

---

Document: ldns_duration2time(3) from ldns 1.9.2-r2 (Chainguard OS)
Source: https://github.com/NLnetLabs/ldns.git
