DD_time.h
2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* 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 */