yumapro  23.10T-7
YumaPro SDK
Loading...
Searching...
No Matches
tstamp.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2008 - 2012, Andy Bierman, All Rights Reserved.
3 * Copyright (c) 2012 - 2021, YumaWorks, Inc., All Rights Reserved.
4 *
5 * Unless required by applicable law or agreed to in writing,
6 * software distributed under the License is distributed on an
7 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8 * KIND, either express or implied. See the License for the
9 * specific language governing permissions and limitations
10 * under the License.
11 */
12#ifndef _H_tstamp
13#define _H_tstamp
14/* FILE: tstamp.h
15*********************************************************************
16* *
17* P U R P O S E *
18* *
19*********************************************************************/
20
26/*********************************************************************
27* *
28* C H A N G E H I S T O R Y *
29* *
30*********************************************************************
31
32date init comment
33----------------------------------------------------------------------
3417-apr-06 abb begun
35*/
36
37#include <time.h>
38#include <sys/time.h>
39
40
41#ifdef __cplusplus
42extern "C" {
43#endif
44
45/********************************************************************
46* *
47* C O N S T A N T S *
48* *
49*********************************************************************/
50
64#define TSTAMP_MIN_HEXSIZE 17
65
71#define TSTAMP_MIN_SIZE 29
72
77#define TSTAMP_DATE_SIZE 12
78
80#define TSTAMP_SQL_SIZE 20
81
83#define TSTAMP_HTML_SIZE 50
84
85
93extern void
94 tstamp_datetime (xmlChar *buff);
95
96
104extern void
105 tstamp_highres_datetime (xmlChar *buff);
106
107
115extern void
117 (xmlChar *buff);
118
119
120
129extern void
130 tstamp_local_highres_datetime (xmlChar *buff);
131
132
140extern void
141 tstamp_date (xmlChar *buff);
142
143
151extern void
152 tstamp_datetime_sql (xmlChar *buff);
153
154
169extern xmlChar *
170 tstamp_convert_to_utctime (const xmlChar *timestr,
171 boolean *isNegative,
172 status_t *res);
173
174
182extern void
183 tstamp_datetime_dirname (xmlChar *buff);
184
185
194extern void
195 tstamp_time2datetime (time_t *timerec,
196 xmlChar *buff);
197
209 tstamp_time2htmltime (time_t *timerec,
210 xmlChar *buff,
211 size_t buffsize);
212
213
222extern status_t
223 tstamp_htmltime2time (const xmlChar *timestr,
224 time_t *timerec);
225
226
239extern int32
240 tstamp_difftime (time_t *time1,
241 time_t *time2);
242
243
250extern void
251 tstamp_now (time_t *tim);
252
253
263extern long int
264 tstamp_diff (struct timeval *start_time,
265 struct timeval *end_time,
266 long int *usec);
267
268
269
279extern void
280 tstamp_time2hex (time_t *tim,
281 xmlChar *buf);
282
283
293extern time_t tstamp_cvt_TIME (char const *time_str);
294
295
296
297
308extern void
309 tstamp_highres_timenow (struct timespec *ts);
310
311
315#ifdef __cplusplus
316} /* end extern 'C' */
317#endif
318
319#endif /* _H_tstamp */
status_t
global error return code
Definition: status_enum.h:210
void tstamp_local_highres_datetime(xmlChar *buff)
Set the current date and time in an XML dateTime string format using highres format.
Definition: tstamp.c:334
status_t tstamp_htmltime2time(const xmlChar *timestr, time_t *timerec)
Convert the specified HTML timestamp string to time_t format.
Definition: tstamp.c:690
void tstamp_time2hex(time_t *tim, xmlChar *buf)
Convert the time_t to a string of hex digits.
Definition: tstamp.c:816
void tstamp_local_datetime(xmlChar *buff)
Set the current date and time in an XML dateTime string format.
Definition: tstamp.c:302
void tstamp_datetime_sql(xmlChar *buff)
Set the current date and time in an XML dateTime string format.
Definition: tstamp.c:394
void tstamp_date(xmlChar *buff)
Set the current date in an XML dateTime string format.
Definition: tstamp.c:359
void tstamp_highres_datetime(xmlChar *buff)
Set the current date and time in an XML dateTime string format using highres format.
Definition: tstamp.c:276
void tstamp_datetime_dirname(xmlChar *buff)
Set the current date and time in an XML dateTime string format.
Definition: tstamp.c:585
time_t tstamp_cvt_TIME(char const *time_str)
Convert the DATE string to a time_t.
Definition: tstamp.c:865
void tstamp_datetime(xmlChar *buff)
Set the current date and time in an XML dateTime string format.
Definition: tstamp.c:244
void tstamp_highres_timenow(struct timespec *ts)
Get the current time using a high res timestamp.
Definition: tstamp.c:900
status_t tstamp_time2htmltime(time_t *timerec, xmlChar *buff, size_t buffsize)
Convert the specified time_t to a HTML timestamp string.
Definition: tstamp.c:650
void tstamp_time2datetime(time_t *timerec, xmlChar *buff)
Convert the specified time_t to a YANG data-and-time format.
Definition: tstamp.c:618
void tstamp_now(time_t *tim)
Set the time_t to the current time.
Definition: tstamp.c:758
long int tstamp_diff(struct timeval *start_time, struct timeval *end_time, long int *usec)
Get the elapsed time between two timeval structs.
Definition: tstamp.c:784
int32 tstamp_difftime(time_t *time1, time_t *time2)
Compare 2 time_t structs.
Definition: tstamp.c:731
xmlChar * tstamp_convert_to_utctime(const xmlChar *timestr, boolean *isNegative, status_t *res)
Check if the specified string is a valid dateTime or date-and-time string is valid and if so,...
Definition: tstamp.c:443