ldns documentation

- Main Page
- Related Pages
- Data Structures
- Files

- File List
- Globals

Functions
duration.c File Reference

Go to the source code of this file.

## Functions
ldns_duration_type * | ldns_duration_create (void)
| This file is copied from the OpenDNSSEC source repository and only slightly adapted to make it fit. More...
int | ldns_duration_compare (ldns_duration_type *d1, ldns_duration_type *d2)
| Compare durations. More...
ldns_duration_type * | ldns_duration_create_from_string (const char *str)
| Create a duration from string. More...
char * | ldns_duration2string (ldns_duration_type *duration)
| Convert a duration to a string. More...
time_t | ldns_duration2time (ldns_duration_type *duration)
| Convert a duration to a time. More...
void | ldns_duration_cleanup (ldns_duration_type *duration)
| Clean up duration. More...

## Function Documentation

ldns_duration_type* ldns_duration_create | ( | void |  | ) |

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

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, ldns_duration_struct::minutes, ldns_duration_struct::months, ldns_duration_struct::seconds, ldns_duration_struct::weeks, and ldns_duration_struct::years.

int ldns_duration_compare | ( | ldns_duration_type * | d1,
|  | ldns_duration_type * | d2
| ) |  |

Compare durations.

Parameters

  [in] | d1 | one duration
  [in] | d2 | another 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.

ldns_duration_type* ldns_duration_create_from_string | ( | const char * | str | ) |

Create a duration from string.

Parameters

  [in] | str | string-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.

char* ldns_duration2string | ( | ldns_duration_type * | duration | ) |

Convert a duration to a string.

Parameters

  [in] | duration | duration 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] | duration | duration 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.

void ldns_duration_cleanup | ( | ldns_duration_type * | duration | ) |

Clean up duration.

Parameters

  [in] | duration | duration to be cleaned up

Definition at line 347 of file duration.c.