GRU - Generic Reusable Utilities
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Data Structures | Typedefs | Functions
gru_duration.h File Reference
#include <math.h>
#include <stdlib.h>
#include <sys/time.h>
#include "common/gru_portable.h"
#include "gru_time_utils.h"

Go to the source code of this file.

Data Structures

struct  gru_duration_t_
 

Typedefs

typedef struct gru_duration_t_ gru_duration_t
 

Functions

gru_export gru_duration_t gru_duration_from_seconds (uint64_t seconds)
 Builds a duration struct that represents a duration. More...
 
gru_export gru_duration_t gru_duration_from_minutes (uint64_t minutes)
 Builds a duration struct that represents a duration. More...
 
gru_export uint64_t gru_duration_seconds (gru_duration_t duration)
 Given a duration object, return the number of seconds between its start and end time. More...
 
gru_export uint64_t gru_duration_minutes (gru_duration_t duration, double *fractional)
 Given a duration object, return the number of minutes between its start and end time. More...
 

Typedef Documentation

Function Documentation

gru_export gru_duration_t gru_duration_from_minutes ( uint64_t  minutes)

Builds a duration struct that represents a duration.

That means, the current time + the given number of minutes

Parameters
minutesthe duration in minutes
Returns
a duration object
gru_export gru_duration_t gru_duration_from_seconds ( uint64_t  seconds)

Builds a duration struct that represents a duration.

That means, the current time + the given number of seconds

Parameters
secondsthe duration in seconds
Returns
a duration object
gru_export uint64_t gru_duration_minutes ( gru_duration_t  duration,
double *  fractional 
)

Given a duration object, return the number of minutes between its start and end time.

Parameters
durationa duration object to calculate
Returns
the time difference in minutes
gru_export uint64_t gru_duration_seconds ( gru_duration_t  duration)

Given a duration object, return the number of seconds between its start and end time.

Parameters
durationa duration object to calculate
Returns
the time difference in seconds