timeutil.h 1.36 KB
Newer Older
1
/* this is <timeutil.h>
2
3
 *
 * $Id: timeutil.h,v 1.2 2000-08-05 19:52:01 thof Exp $
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
60
61
62
63
64
65
66
67
68
69
70
 *
 * this file contains definitions for timeutil.c routines
 *
 * 25/04/97   Thomas Forbriger (IfG Stuttgart)
 *
 */

#ifndef _TF_TIMEUTIL_H
#define _TF_TIMEUTIL_H

/* 
 * define macros
 * =============
 */

/* number of long ints in structure */
#define TIMEUTIL_N_ELEMENTS 9

/* first linear element in structure */
#define TIMEUTIL_FIRST_LINEAR 5

/*
 * define data structures
 * ======================
 */

/* time data structure */
typedef struct {
  long int year, month, day, doy;
  long int hour, min, sec, msec, usec;
} timeutil_Ttime;

/*
 * prototypes
 * ==========
 */

/* clear a time record */
void timeutil_clear(timeutil_Ttime *);

/* type out a time record */
char *timeutil_print(timeutil_Ttime);

/* finish a preset time record */
void timeutil_finish(timeutil_Ttime *);

/* calculate doy */
long int timeutil_doy(timeutil_Ttime);

/* check for leap year */
int timeutil_is_leap(long int);

/* set date from doy */
void timeutil_date(timeutil_Ttime *, long int);

/* set elements to correct value range */
void timeutil_norm(timeutil_Ttime *);

/* add two time records */
void timeutil_add(timeutil_Ttime *, timeutil_Ttime, timeutil_Ttime);

/* compare two time records */
int timeutil_compare(timeutil_Ttime, timeutil_Ttime);

#endif /* _TF_TIMEUTIL_H */

/***** END OF timeutil.h *****/