yumapro  25.10-1
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
89#define TSTAMP_MIN_YANG_SIZE 19
90
91
99extern void
100 tstamp_datetime (xmlChar *buff);
101
102
110extern void
111 tstamp_highres_datetime (xmlChar *buff);
112
113
121extern void
123 (xmlChar *buff);
124
125
126
135extern void
136 tstamp_local_highres_datetime (xmlChar *buff);
137
138
146extern void
147 tstamp_date (xmlChar *buff);
148
149
157extern void
158 tstamp_datetime_sql (xmlChar *buff);
159
160
175extern xmlChar *
176 tstamp_convert_to_utctime (const xmlChar *timestr,
177 boolean *isNegative,
178 status_t *res);
179
180
188extern void
189 tstamp_datetime_dirname (xmlChar *buff);
190
191
200extern void
201 tstamp_time2datetime (time_t *timerec,
202 xmlChar *buff);
203
213extern void
214 tstamp_local_time2datetime (time_t *timerec,
215 xmlChar *buff);
216
228 tstamp_time2htmltime (time_t *timerec,
229 xmlChar *buff,
230 size_t buffsize);
231
232
241extern status_t
242 tstamp_htmltime2time (const xmlChar *timestr,
243 time_t *timerec);
244
245
258extern int32
259 tstamp_difftime (time_t *time1,
260 time_t *time2);
261
262
269extern void
270 tstamp_now (time_t *tim);
271
272
282extern long int
283 tstamp_diff (struct timeval *start_time,
284 struct timeval *end_time,
285 long int *usec);
286
287
288
298extern void
299 tstamp_time2hex (time_t *tim,
300 xmlChar *buf);
301
302
313extern status_t
314 tstamp_convert_to_time (const xmlChar *timestr,
315 time_t *rtime);
316
317
327extern time_t tstamp_cvt_TIME (char const *time_str);
328
329
330
331
342extern void
343 tstamp_highres_timenow (struct timespec *ts);
344
345
361extern void
362 tstamp_set_datetime (xmlChar *buff,
363 boolean use_local);
364
365
377 tstamp_time2localtime (time_t *timerec,
378 xmlChar *buff,
379 size_t buffsize);
380
381
398extern status_t
399 tstamp_get_time_parts (const xmlChar *datestr,
400 uint32 *hours,
401 uint32 *minutes,
402 uint32 *seconds);
403
404
408#ifdef __cplusplus
409} /* end extern 'C' */
410#endif
411
412#endif /* _H_tstamp */
status_t
global error return code
Definition: status_enum.h:219
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
status_t tstamp_htmltime2time(const xmlChar *timestr, time_t *timerec)
Convert the specified HTML timestamp string to time_t format.
Definition: tstamp.c:752
void tstamp_time2hex(time_t *tim, xmlChar *buf)
Convert the time_t to a string of hex digits.
Definition: tstamp.c:878
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:1037
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:1072
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:712
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:820
status_t tstamp_get_time_parts(const xmlChar *datestr, uint32 *hours, uint32 *minutes, uint32 *seconds)
@
Definition: tstamp.c:1196
status_t tstamp_time2localtime(time_t *timerec, xmlChar *buff, size_t buffsize)
Convert the specified time_t to a localtime string.
Definition: tstamp.c:1147
void tstamp_set_datetime(xmlChar *buff, boolean use_local)
Set the current date and time in the buffer.
Definition: tstamp.c:1119
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:931
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:846
int32 tstamp_difftime(time_t *time1, time_t *time2)
Compare 2 time_t structs.
Definition: tstamp.c:793
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