RAVE
rave_datetime.c File Reference

Object for managing date and time. More...

#include "rave_datetime.h"
#include "rave_debug.h"
#include "rave_alloc.h"
#include <string.h>
#include <time.h>
#include <stdio.h>

Classes

struct  _RaveDateTime_t
 Represents a date time instance. More...
 

Macros

#define __USE_XOPEN   1
 
#define _XOPEN_SOURCE   700
 

Functions

int RaveDateTime_setTime (RaveDateTime_t *dt, const char *value)
 Sets the nominal time.
 
const char * RaveDateTime_getTime (RaveDateTime_t *dt)
 Returns the nominal time.
 
int RaveDateTime_setDate (RaveDateTime_t *dt, const char *value)
 Sets the nominal date.
 
const char * RaveDateTime_getDate (RaveDateTime_t *dt)
 Returns the nominal date.
 
int RaveDateTime_strptime (char *yyyymmddHHMMSS, struct tm *ts)
 
int RaveDateTime_compare (RaveDateTime_t *self, RaveDateTime_t *other)
 Compares self with another datetime object.
 

Variables

RaveCoreObjectType RaveDateTime_TYPE
 Type definition to use when creating a rave object.
 

Detailed Description

Object for managing date and time.

Author
Anders Henja (Swedish Meteorological and Hydrological Institute, SMHI)
Date
2009-12-16

Function Documentation

◆ RaveDateTime_compare()

int RaveDateTime_compare ( RaveDateTime_t * self,
RaveDateTime_t * other )

Compares self with another datetime object.

If the datetime is equal, 0 is returned, if self is before other a negative value is returned and if self is after other a positive number is returned.

◆ RaveDateTime_getDate()

const char * RaveDateTime_getDate ( RaveDateTime_t * dt)

Returns the nominal date.

Parameters
[in]dt- self
Returns
the nominal time (or NULL if there is none)

◆ RaveDateTime_getTime()

const char * RaveDateTime_getTime ( RaveDateTime_t * dt)

Returns the nominal time.

Parameters
[in]dt- self
Returns
the nominal time (or NULL if there is none)

◆ RaveDateTime_setDate()

int RaveDateTime_setDate ( RaveDateTime_t * dt,
const char * value )

Sets the nominal date.

Parameters
[in]dt- self
[in]value- the date in the format YYYYMMDD
Returns
1 on success, otherwise 0

◆ RaveDateTime_setTime()

int RaveDateTime_setTime ( RaveDateTime_t * dt,
const char * value )

Sets the nominal time.

Parameters
[in]dt- self
[in]value- the time in the format HHmmss
Returns
1 on success, otherwise 0

Variable Documentation

◆ RaveDateTime_TYPE

RaveCoreObjectType RaveDateTime_TYPE
Initial value:
= {
"RaveDateTime",
sizeof(RaveDateTime_t),
RaveDateTime_constructor,
RaveDateTime_destructor,
RaveDateTime_copyconstructor
}
struct _RaveDateTime_t RaveDateTime_t
Defines a Rave date/time.
Definition rave_datetime.h:34

Type definition to use when creating a rave object.