1 /*
2  * International Chemical Identifier (InChI)
3  * Version 1
4  * Software version 1.04
5  * September 9, 2011
6  *
7  * The InChI library and programs are free software developed under the
8  * auspices of the International Union of Pure and Applied Chemistry (IUPAC).
9  * Originally developed at NIST. Modifications and additions by IUPAC
10  * and the InChI Trust.
11  *
12  * IUPAC/InChI-Trust Licence for the International Chemical Identifier (InChI)
13  * Software version 1.0.
14  * Copyright (C) IUPAC and InChI Trust Limited
15  *
16  * This library is free software; you can redistribute it and/or modify it under the
17  * terms of the IUPAC/InChI Trust Licence for the International Chemical Identifier
18  * (InChI) Software version 1.0; either version 1.0 of the License, or
19  * (at your option) any later version.
20  *
21  * This library is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
24  * See the IUPAC/InChI Trust Licence for the International Chemical Identifier (InChI)
25  * Software version 1.0 for more details.
26  *
27  * You should have received a copy of the IUPAC/InChI Trust Licence for the
28  * International Chemical Identifier (InChI) Software version 1.0 along with
29  * this library; if not, write to:
30  *
31  * The InChI Trust
32  * c/o FIZ CHEMIE Berlin
33  * Franklinstrasse 11
34  * 10587 Berlin
35  * GERMANY
36  *
37  */
38 
39 
40 #ifndef __ICHITIME_H__
41 #define __ICHITIME_H__
42 
43 
44 #ifdef COMPILE_ANSI_ONLY
45 
46 #ifdef __FreeBSD__
47 #include <sys/time.h>
48 #endif
49 
50 /* get times() */
51 #ifdef INCHI_USETIMES
52 #include <sys/times.h>
53 #endif
54 
55 /*#include <sys/timeb.h>*/
56 
57 #include <time.h>
58 
59 typedef struct tagInchiTime {
60     clock_t clockTime;
61 } inchiTime;
62 
63 #else
64 
65 /* Win32 _ftime(): */
66 #include <sys/timeb.h>
67 
68 typedef struct tagInchiTime {
69     unsigned long  clockTime; /* Time in seconds since midnight (00:00:00), January 1, 1970;
70                                  signed long overflow expected in 2038 */
71     long           millitime; /* milliseconds */
72 
73 } inchiTime;
74 
75 #endif
76 
77 
78 #ifdef TARGET_EXE_USING_API
79 
80 #define InchiTimeGet           e_InchiTimeGet
81 #define InchiTimeMsecDiff      e_InchiTimeMsecDiff
82 #define InchiTimeAddMsec       e_InchiTimeAddMsec
83 #define bInchiTimeIsOver       e_bInchiTimeIsOver
84 #define InchiTimeElapsed       e_InchiTimeElapsed
85 
86 #define FullMaxClock           e_FullMaxClock
87 #define HalfMaxClock           e_HalfMaxClock
88 #define MaxPositiveClock       e_MaxPositiveClock
89 #define MinNegativeClock       e_MinNegativeClock
90 #define HalfMaxPositiveClock   e_HalfMaxPositiveClock
91 #define HalfMinNegativeClock   e_HalfMinNegativeClock
92 
93 
94 
95 #endif
96 
97 #ifndef COMPILE_ALL_CPP
98 #ifdef __cplusplus
99 extern "C" {
100 #endif
101 #endif
102 
103 
104 void InchiTimeGet( inchiTime *TickEnd );
105 long InchiTimeMsecDiff( inchiTime *TickEnd, inchiTime *TickStart );
106 void InchiTimeAddMsec( inchiTime *TickEnd, unsigned long nNumMsec );
107 int  bInchiTimeIsOver( inchiTime *TickEnd );
108 long InchiTimeElapsed( inchiTime *TickStart );
109 
110 #ifndef COMPILE_ALL_CPP
111 #ifdef __cplusplus
112 }
113 #endif
114 #endif
115 
116 
117 #endif /* __ICHITIME_H__ */
118 
119