yumapro  24.10-2
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 - 2024, 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
207extern void
208 tstamp_local_time2datetime (time_t *timerec,
209 xmlChar *buff);
210
222 tstamp_time2htmltime (time_t *timerec,
223 xmlChar *buff,
224 size_t buffsize);
225
226
235extern status_t
236 tstamp_htmltime2time (const xmlChar *timestr,
237 time_t *timerec);
238
239
252extern int32
253 tstamp_difftime (time_t *time1,
254 time_t *time2);
255
256
263extern void
264 tstamp_now (time_t *tim);
265
266
276extern long int
277 tstamp_diff (struct timeval *start_time,
278 struct timeval *end_time,
279 long int *usec);
280
281
282
292extern void
293 tstamp_time2hex (time_t *tim,
294 xmlChar *buf);
295
296
307extern status_t
308 tstamp_convert_to_time (const xmlChar *timestr,
309 time_t *rtime);
310
311
321extern time_t tstamp_cvt_TIME (char const *time_str);
322
323
324
325
336extern void
337 tstamp_highres_timenow (struct timespec *ts);
338
339
355extern void
356 tstamp_set_datetime (xmlChar *buff,
357 bool use_local);
358
359
363#ifdef __cplusplus
364} /* end extern 'C' */
365#endif
366
367#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:339
void tstamp_set_datetime(xmlChar *buff, bool use_local)
Set the current date and time in the buffer.
status_t tstamp_htmltime2time(const xmlChar *timestr, time_t *timerec)
Convert the specified HTML timestamp string to time_t format.
Definition: tstamp.c:751
void tstamp_time2hex(time_t *tim, xmlChar *buf)
Convert the time_t to a string of hex digits.
Definition: tstamp.c:877
void tstamp_local_datetime(xmlChar *buff)
Set the current date and time in an XML dateTime string format.
Definition: tstamp.c:307
void tstamp_datetime_sql(xmlChar *buff)
Set the current date and time in an XML dateTime string format.
Definition: tstamp.c:400
void tstamp_local_time2datetime(time_t *timerec, xmlChar *buff)
Convert the specified time_t to a local time YANG date-and-time format.
Definition: tstamp.c:680
void tstamp_date(xmlChar *buff)
Set the current date in an XML dateTime string format.
Definition: tstamp.c:364
void tstamp_highres_datetime(xmlChar *buff)
Set the current date and time in an XML dateTime string format using highres format.
Definition: tstamp.c:281
void tstamp_datetime_dirname(xmlChar *buff)
Set the current date and time in an XML dateTime string format.
Definition: tstamp.c:616
time_t tstamp_cvt_TIME(char const *time_str)
Convert the DATE string to a time_t.
Definition: tstamp.c:1024
void tstamp_datetime(xmlChar *buff)
Set the current date and time in an XML dateTime string format.
Definition: tstamp.c:249
void tstamp_highres_timenow(struct timespec *ts)
Get the current time using a high res timestamp.
Definition: tstamp.c:1059
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:711
void tstamp_time2datetime(time_t *timerec, xmlChar *buff)
Convert the specified time_t to a YANG data-and-time format.
Definition: tstamp.c:649
void tstamp_now(time_t *tim)
Set the time_t to the current time.
Definition: tstamp.c:819
status_t tstamp_convert_to_time(const xmlChar *timestr, time_t *rtime)
Check if the specified string is a valid dateTime or date-and-time string is valid and if so,...
Definition: tstamp.c:930
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:845
int32 tstamp_difftime(time_t *time1, time_t *time2)
Compare 2 time_t structs.
Definition: tstamp.c:792
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:450