DD_time.h 2.42 KB
/* This is header file for working with DD time */
/*                       V.4.1                  */
/* name:        DD_time.h 
 * Author:      Andrey Fredorov
 * Institution: IKI RAN
 * Date:        21-Feb-1995
 * Last update  Sept 05, 2011
 * 	     Sept 05, 2011: V.3.2  SetIntNew =>  arg TimeKind => to work with 1970-1973 : BR
 */

#define TIMELENGTH 17

typedef char dd_time_t[TIMELENGTH]; /* YYYYDDDHHMMSSMLS */

/* ---------------- Functions prototypes  ----------------------*/
extern   double DD_Time2Double(dd_time_t  DD_Time);
/* Convert string to double and return.
 * Return negative value in case of error string format
 */
extern char *Double2DD_Time(double Time);
/* Convert double Time value into string form and return pointer to static string
 * allocated INSIDE the library.    Thus the value is renoveted each function call.
 */

/*---------------- Backup compability with V.3.0 and earlier ----------*/
typedef struct { double times;  /* time sec from 1970 */
                 int year;
                 int day;
                 int hour;
                 int min;
                 int sec;
                 int msec;
               } dd_tmstr_t ;


extern dd_tmstr_t *ReadTime(char *UT); /* Read time from sring and fill static
                                          * structure defined IN function.
                                          * Returns pointer of strusture */
extern char *WriteTime(dd_tmstr_t *UT); /* Get pointer of time structure
                                           * and convert it into string
                                           * Function returns pointer of
                                           * internal string */

extern void WriteFmtTime(dd_tmstr_t *UT,char *UTstring);

extern void SetDouble(dd_tmstr_t *UT); /* Fill double value of dd_tmstr_t */

typedef enum {DD_TM_UNKNOWN, DD_TM_TIME_INTERVAL, DD_TM_DATE} t_DDTimeKind; 

extern void SetInt(dd_tmstr_t *UT); /* Fill int values of dd_tmstr_t */
extern void SetIntNew(dd_tmstr_t *UT,t_DDTimeKind timeKind);

/*------- Functions for DECODERS ------------------------
 *These functions works with with Gavrilova's UT representation  */
extern dd_tmstr_t *UT2double(unsigned *UT); /* Set standard time
                                             * structure and return
                                             * its pointer
                                             */
extern unsigned *Double2UT(double Time); /*Converts Double to Gavrilova array */