mtime 1.3.0
Loading...
Searching...
No Matches
mtime_timedelta.h File Reference

TimeDelta and some operations supported on TimeDelta. More...

#include <stdint.h>
#include <stdbool.h>
#include "mtime_calendar.h"
Include dependency graph for mtime_timedelta.h:

Go to the source code of this file.

Data Structures

struct  _timedelta
 Struct _timedelta containing timedelta and sign of year parameter. More...
 
struct  _divisionquotienttimespan
 Struct _divisionquotienttimespan is used for storing division of two time-delta results. More...
 

Functions

struct _timedeltanewTimeDelta (const char *timedelta_string)
 Construct new TimeDelta using an ISO 8601 conforming string.
 
struct _timedeltanewRawTimeDelta (char _sign, int64_t _year, int _month, int _day, int _hour, int _minute, int _second, int _ms)
 Construct new TimeDelta using 'raw' numerical values.
 
struct _timedeltaconstructAndCopyTimeDelta (struct _timedelta *td)
 Copy the values and construct a new TimeDelta.
 
void deallocateTimeDelta (struct _timedelta *td)
 Destructor of TimeDelta.
 
compare_return_val compareTimeDelta (struct _timedelta *td1, struct _timedelta *td2)
 Compare two timedelta and return (td1 > td2) OR (td1 = td2) OR (td1 < td2).
 
struct _timedeltareplaceTimeDelta (struct _timedelta *tdsrc, struct _timedelta *tddest)
 COPY a TimeDelta object.
 
struct _juliandelta * timeDeltaToJulianDelta (struct _timedelta *td, struct _datetime *dt, struct _juliandelta *jd)
 
struct _timedeltajulianDeltaToTimeDelta (struct _juliandelta *jd, struct _datetime *dt, struct _timedelta *td_return)
 
struct _divisionquotienttimespandivideTimeDeltaInSeconds (struct _timedelta *dividend, struct _timedelta *divisor, struct _divisionquotienttimespan *quo_ret)
 
struct _divisionquotienttimespandivideTwoDatetimeDiffsInSeconds (struct _datetime *dt1_dividend, struct _datetime *dt2_dividend, struct _datetime *dt1_divisor, struct _datetime *dt2_divisor, int64_t *denominator_ret, struct _divisionquotienttimespan *quo_ret)
 division of two differences in datetimes.
 
struct _divisionquotienttimespandivideDatetimeDifferenceInSeconds (struct _datetime *dt1, struct _datetime *dt2, struct _timedelta *divisor, struct _divisionquotienttimespan *quo_ret)
 division by an interval given in of seconds.
 
struct _timedeltagetTimeDeltaFromDate (struct _date *, struct _date *, struct _timedelta *)
 Get the TimeDelta between two Dates d1 and d2 as (d1-d2).
 
struct _timedeltagetTimeDeltaFromDateTime (struct _datetime *dt1, struct _datetime *dt2, struct _timedelta *td_return)
 Get the TimeDelta between two DateTimes dt1 and dt2 as (dt1-dt2).
 
int64_t getTotalMilliSecondsTimeDelta (struct _timedelta *td, struct _datetime *dt)
 Get total number of milliseconds in timedelta.
 
int64_t getTotalSecondsTimeDelta (struct _timedelta *td, struct _datetime *dt)
 Get total number of seconds in timedelta.
 
char * timedeltaToString (struct _timedelta *td, char *toString)
 Get TimeDelta as an extended string.
 
struct _dateaddTimeDeltaToDate (struct _date *dt, struct _timedelta *td, struct _date *dt_return)
 Add timedelta to Date.
 
struct _datetimeaddTimeDeltaToDateTime (struct _datetime *dt, struct _timedelta *td, struct _datetime *dt_return)
 Add timedelta to DateTime.
 
struct _timedeltamoduloTimeDeltaFromDateTime (struct _datetime *start_dt, struct _timedelta *timestep, struct _datetime *current_dt, struct _timedelta *modulo_td)
 Get the timedelta between current_dt and start_dt plus next integral-multiple-of-timestep (timedelta).
 
struct _timedeltaelementwiseScalarMultiplyTimeDelta (struct _timedelta *base_td, int64_t lambda, struct _timedelta *scaled_td)
 Return the element-wise product of a scalar and a timedelta.
 
struct _timedeltaelementwiseAddTimeDeltatoTimeDelta (struct _timedelta *td1, struct _timedelta *td2, struct _timedelta *td_return)
 Return the element-wise sum of two timedeltas.
 
int64_t moduloTimedelta (struct _timedelta *a, struct _timedelta *p, int64_t *quot)
 Returns the remainder of timedelta a modulo timedelta p.
 
char * getPTStringFromMS (int64_t _ms, char *PTstr)
 Return a PT String corresponding to arbitrary number of milliseconds.
 
char * getPTStringFromSeconds (int64_t _s, char *PTstr)
 Return a PT String corresponding to arbitrary number of seconds.
 
char * getPTStringFromSecondsFloat (float _s, char *PTstr)
 Return a PT String corresponding to arbitrary number of seconds.
 
char * getPTStringFromSecondsDouble (double _s, char *PTstr)
 Return a PT String corresponding to arbitrary number of seconds.
 
char * getPTStringFromMinutes (int64_t _m, char *PTstr)
 Return a PT String corresponding to arbitrary number of minutes.
 
char * getPTStringFromHours (int64_t _h, char *PTstr)
 Return a PT String corresponding to arbitrary number of Hours.
 

Detailed Description

TimeDelta and some operations supported on TimeDelta.

Author
Luis Kornblueh, Max Planck Institute for Meteorology.
Rahul Sinha, Max Planck Institute for Meteorology.
Date
March 2013