/build/ldns-00A0O8/ldns-1.8.4/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.
int | ldns_duration_compare (const ldns_duration_type *d1, const ldns_duration_type *d2)
| Compare durations.
ldns_duration_type * | ldns_duration_create_from_string (const char *str)
| Create a duration from string.
char * | ldns_duration2string (const ldns_duration_type *d)
| Convert a duration to a string.
time_t | ldns_duration2time (const ldns_duration_type *duration)
| Convert a duration to a time.
void | ldns_duration_cleanup (ldns_duration_type *duration)
| Clean up duration.

## Function Documentation

## ldns_duration_create()

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.

## ldns_duration_compare()

int ldns_duration_compare | ( | const ldns_duration_type * | d1,
|  | const 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_create_from_string()

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.

## ldns_duration2string()

char * ldns_duration2string | ( | const 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 211 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_duration2time()

time_t ldns_duration2time | ( | const 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 246 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_cleanup()

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

Clean up duration.

Parameters

  [in] | duration | duration to be cleaned up

Definition at line 274 of file duration.c.