Adaptive Framework  0.9.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
afw_time.h
Go to the documentation of this file.
1 // See the 'COPYING' file in the project root for licensing information.
2 /*
3  * Adaptive Framework Time Support Header
4  *
5  * Copyright (c) 2010-2023 Clemson University
6  *
7  */
8 
9 #ifndef __AFW_TIME_H__
10 #define __AFW_TIME_H__
11 
12 #include "afw_interface.h"
13 
29 
30 #define AFW_TIME_SECONDS_TO_MICROSECONDS(SECONDS) \
31  (afw_integer_t)(SECONDS) * (afw_integer_t)1000000
32 
33 #define AFW_TIME_MINUTES_TO_MICROSECONDS(MINUTES) \
34  AFW_TIME_SECONDS_TO_MICROSECONDS( \
35  (afw_integer_t)(MINUTES) * (afw_integer_t)60)
36 
37 #define AFW_TIME_HOURS_TO_MICROSECONDS(HOURS) \
38  AFW_TIME_MINUTES_TO_MICROSECONDS( \
39  (afw_integer_t)(HOURS) * (afw_integer_t)60)
40 
41 #define AFW_TIME_DAYS_TO_MICROSECONDS(DAYS) \
42  AFW_TIME_HOURS_TO_MICROSECONDS( \
43  (afw_integer_t)(DAYS) * (afw_integer_t)24)
44 
45 
57 AFW_DECLARE(void)
59  afw_date_t *date,
60  int year,
61  int month,
62  int day,
63  int tz_hours_offset,
64  int tz_minutes_offset,
65  afw_xctx_t *xctx);
66 
67 
81 AFW_DECLARE(const afw_date_t *)
83  int year,
84  int month,
85  int day,
86  int tz_hours_offset,
87  int tz_minutes_offset,
88  const afw_pool_t *p,
89  afw_xctx_t *xctx);
90 
91 
92 
99 AFW_DECLARE(void)
101  afw_dateTime_t *dateTime,
102  apr_time_t apr_time,
103  afw_xctx_t *xctx);
104 
105 
106 
116  apr_time_t apr_time,
117  const afw_pool_t *p,
118  afw_xctx_t *xctx);
119 
120 
121 
137 AFW_DECLARE(void)
139  afw_dateTime_t *dateTime,
140  int year,
141  int month,
142  int day,
143  int hour,
144  int minute,
145  int second,
146  int microsecond,
147  int tz_hours_offset,
148  int tz_minutes_offset,
149  afw_xctx_t *xctx);
150 
151 
171  int year,
172  int month,
173  int day,
174  int hour,
175  int minute,
176  int second,
177  int microsecond,
178  int tz_hours_offset,
179  int tz_minutes_offset,
180  const afw_pool_t *p,
181  afw_xctx_t *xctx);
182 
183 
184 
196 AFW_DECLARE(void)
198  afw_dayTimeDuration_t *dayTimeDuration,
199  afw_boolean_t is_positive,
200  int days,
201  int hours,
202  int minutes,
203  int seconds,
204  int microseconds,
205  afw_xctx_t *xctx)
206 ;
207 
208 
223  afw_boolean_t is_positive,
224  afw_int32_t days,
225  afw_int32_t hours,
226  afw_int32_t minutes,
227  afw_int32_t seconds,
228  afw_int32_t microseconds,
229  const afw_pool_t *p,
230  afw_xctx_t *xctx);
231 
232 
233 
246 AFW_DECLARE(void)
248  afw_time_t *time,
249  int hour,
250  int minute,
251  int second,
252  int microsecond,
253  int tz_hours_offset,
254  int tz_minutes_offset,
255  afw_xctx_t *xctx);
256 
257 
272 AFW_DECLARE(const afw_time_t *)
274  int hour,
275  int minute,
276  int second,
277  int microsecond,
278  int tz_hours_offset,
279  int tz_minutes_offset,
280  const afw_pool_t *p,
281  afw_xctx_t *xctx);
282 
283 
284 
293 AFW_DECLARE(void)
295  afw_yearMonthDuration_t *yearMonthDuration,
296  afw_boolean_t is_positive,
297  int years,
298  int months,
299  afw_xctx_t *xctx);
300 
301 
313  afw_boolean_t is_positive,
314  afw_int32_t years,
315  afw_int32_t months,
316  const afw_pool_t *p,
317  afw_xctx_t *xctx);
318 
319 
320 
327 AFW_DECLARE(void)
329  afw_dateTime_t *dateTime_local, afw_dateTime_t *dateTime_utc,
330  afw_xctx_t *xctx);
331 
332 
339 AFW_DECLARE(void)
341  afw_time_t *time_local, afw_time_t *time_utc,
342  afw_xctx_t *xctx);
343 
344 
353  const afw_pool_t *p, afw_xctx_t *xctx);
354 
355 
362 AFW_DECLARE(const afw_time_t *)
364  const afw_pool_t *p, afw_xctx_t *xctx);
365 
366 
367 
376  const afw_pool_t *p, afw_xctx_t *xctx);
377 
378 
379 
386 AFW_DECLARE(const afw_time_t *)
388  const afw_pool_t *p, afw_xctx_t *xctx);
389 
390 
391 
400  const afw_time_t *time, afw_xctx_t *xctx);
401 
402 
409 AFW_DECLARE(int)
411  afw_integer_t year, afw_integer_t month);
412 
413 
420 AFW_DECLARE(const afw_utf8_t *)
422  const afw_date_t *date, const afw_pool_t *p, afw_xctx_t *xctx);
423 
424 
425 
432 AFW_DECLARE(void)
434  const afw_utf8_t *utf8, afw_date_t *internal, afw_xctx_t *xctx);
435 
436 
444 AFW_DECLARE(const afw_utf8_t *)
446  const afw_dateTime_t *dateTime, const afw_pool_t *p, afw_xctx_t *xctx);
447 
448 
449 
456 AFW_DECLARE(void)
458  const afw_utf8_t *utf8, afw_dateTime_t *internal, afw_xctx_t *xctx);
459 
460 
468 AFW_DECLARE(const afw_utf8_t *)
470  const afw_dayTimeDuration_t *dayTimeDuration,
471  const afw_pool_t *p, afw_xctx_t *xctx);
472 
473 
474 
481 AFW_DECLARE(void)
483  const afw_utf8_t *utf8, afw_dayTimeDuration_t *internal, afw_xctx_t *xctx);
484 
485 
492 AFW_DECLARE(const afw_utf8_t *)
494  const afw_time_t *time, const afw_pool_t *p, afw_xctx_t *xctx);
495 
496 
497 
504 AFW_DECLARE(void)
506  const afw_utf8_t *utf8, afw_time_t *internal, afw_xctx_t *xctx);
507 
508 
516 AFW_DECLARE(const afw_utf8_t *)
518  const afw_yearMonthDuration_t *yearMonthDuration,
519  const afw_pool_t *p, afw_xctx_t *xctx);
520 
521 
522 
529 AFW_DECLARE(void)
531  const afw_utf8_t *utf8, afw_yearMonthDuration_t *internal,
532  afw_xctx_t *xctx);
533 
534 
543 AFW_DECLARE(int)
544 afw_date_compare(const afw_date_t *v1, const afw_date_t *v2,
545  afw_xctx_t *xctx);
546 
547 
556 AFW_DECLARE(int)
558  afw_xctx_t *xctx);
559 
560 
569 AFW_DECLARE(int)
570 afw_time_compare(const afw_time_t *v1, const afw_time_t *v2,
571  afw_xctx_t *xctx);
572 
573 
582 AFW_DECLARE(int)
584  const afw_dayTimeDuration_t *v2, afw_xctx_t *xctx);
585 
586 
593 AFW_DECLARE(int)
595  const afw_yearMonthDuration_t *v2, afw_xctx_t *xctx);
596 
597 
604 AFW_DECLARE(void)
606  afw_date_t *date,
607  const afw_yearMonthDuration_t *yearMonthDuration,
608  afw_xctx_t *xctx);
609 
610 
617 AFW_DECLARE(void)
619  afw_date_t *date,
620  const afw_yearMonthDuration_t *yearMonthDuration,
621  afw_xctx_t *xctx);
622 
623 
630 AFW_DECLARE(void)
632  afw_dateTime_t *dateTime,
633  const afw_dayTimeDuration_t *dayTimeDuration,
634  afw_xctx_t *xctx);
635 
636 
643 AFW_DECLARE(void)
645  afw_dateTime_t *dateTime,
646  const afw_dayTimeDuration_t *dayTimeDuration,
647  afw_xctx_t *xctx);
648 
649 
656 AFW_DECLARE(void)
658  afw_dateTime_t *dateTime,
659  const afw_yearMonthDuration_t *yearMonthDuration,
660  afw_xctx_t *xctx);
661 
662 
669 AFW_DECLARE(void)
671  afw_dateTime_t *dateTime,
672  const afw_yearMonthDuration_t *yearMonthDuration,
673  afw_xctx_t *xctx);
674 
675 
683 AFW_DECLARE(const afw_utf8_t *)
685  const afw_dateTime_t *dateTime,
686  const afw_pool_t *p, afw_xctx_t *xctx);
687 
694 AFW_DECLARE(void)
696  const afw_utf8_t *generalized_time, afw_dateTime_t *internal,
697  afw_xctx_t *xctx);
698 
699 
700 AFW_END_DECLARES
701 
704 #endif /* __AFW_TIME_H__ */
#define AFW_BEGIN_DECLARES
#define AFW_DECLARE(type)
Declare a public afw function.
Interfaceafw_interface header.
apr_int32_t afw_int32_t
32-bit signed integer.
Definition: afw_common.h:163
_Bool afw_boolean_t
Definition: afw_common.h:373
apr_int64_t afw_integer_t
typedef for big signed int.
Definition: afw_common.h:321
const afw_time_t * afw_time_now_local(const afw_pool_t *p, afw_xctx_t *xctx)
Get now local time as time only in specified pool.
Definition: afw_time.c:652
const afw_date_t * afw_date_create_from_parts(int year, int month, int day, int tz_hours_offset, int tz_minutes_offset, const afw_pool_t *p, afw_xctx_t *xctx)
Create afw_date_t from parts in specific pool.
Definition: afw_time.c:219
void afw_date_subtract_yearMonthDuration(afw_date_t *date, const afw_yearMonthDuration_t *yearMonthDuration, afw_xctx_t *xctx)
Subtract yearMonthDuration from date.
Definition: afw_time.c:1821
const afw_utf8_t * afw_dayTimeDuration_internal_to_utf8(const afw_dayTimeDuration_t *dayTimeDuration, const afw_pool_t *p, afw_xctx_t *xctx)
Convert internal dayTimeDuration to utf8 xml schema dayTimeDuration in specified pool.
Definition: afw_time.c:1126
void afw_dateTime_set_from_parts(afw_dateTime_t *dateTime, int year, int month, int day, int hour, int minute, int second, int microsecond, int tz_hours_offset, int tz_minutes_offset, afw_xctx_t *xctx)
Set afw_dateTime_t from parts.
Definition: afw_time.c:244
void afw_date_add_yearMonthDuration(afw_date_t *date, const afw_yearMonthDuration_t *yearMonthDuration, afw_xctx_t *xctx)
Add yearMonthDuration to date.
Definition: afw_time.c:1791
const afw_dayTimeDuration_t * afw_dayTimeDuration_create_from_parts(afw_boolean_t is_positive, afw_int32_t days, afw_int32_t hours, afw_int32_t minutes, afw_int32_t seconds, afw_int32_t microseconds, const afw_pool_t *p, afw_xctx_t *xctx)
Create afw_dayTimeDuration_t from parts in specific pool.
Definition: afw_time.c:404
int afw_yearMonthDuration_compare(const afw_yearMonthDuration_t *v1, const afw_yearMonthDuration_t *v2, afw_xctx_t *xctx)
compare two yearMonthDuration values.
Definition: afw_time.c:1773
void afw_time_set_now(afw_time_t *time_local, afw_time_t *time_utc, afw_xctx_t *xctx)
Set local and/or utc time to now.
Definition: afw_time.c:558
void afw_date_utf8_set_internal(const afw_utf8_t *utf8, afw_date_t *internal, afw_xctx_t *xctx)
Convert utf8 xml schema date to internal and set.
Definition: afw_time.c:1061
int afw_dayTimeDuration_compare(const afw_dayTimeDuration_t *v1, const afw_dayTimeDuration_t *v2, afw_xctx_t *xctx)
compare two dateTime values.
Definition: afw_time.c:1751
const afw_yearMonthDuration_t * afw_yearMonthDuration_create_from_parts(afw_boolean_t is_positive, afw_int32_t years, afw_int32_t months, const afw_pool_t *p, afw_xctx_t *xctx)
Create afw_yearMonthDuration_t from parts in specific pool.
Definition: afw_time.c:505
void afw_dataType_generalized_time_set_internal(const afw_utf8_t *generalized_time, afw_dateTime_t *internal, afw_xctx_t *xctx)
Convert generalized time (see X.208) to internal and set.
Definition: afw_time.c:2063
const afw_utf8_t * afw_date_internal_to_utf8(const afw_date_t *date, const afw_pool_t *p, afw_xctx_t *xctx)
Convert internal date to utf8 xml schema date in specified pool.
Definition: afw_time.c:1045
const afw_dateTime_t * afw_dateTime_now_local(const afw_pool_t *p, afw_xctx_t *xctx)
Get now local time as dateTime in specified pool.
Definition: afw_time.c:639
void afw_dayTimeDuration_set_from_parts(afw_dayTimeDuration_t *dayTimeDuration, afw_boolean_t is_positive, int days, int hours, int minutes, int seconds, int microseconds, afw_xctx_t *xctx)
Set afw_dayTimeDuration_t from parts.
Definition: afw_time.c:340
void afw_date_set_from_parts(afw_date_t *date, int year, int month, int day, int tz_hours_offset, int tz_minutes_offset, afw_xctx_t *xctx)
Set afw_date_t from parts.
Definition: afw_time.c:197
const afw_utf8_t * afw_dateTime_internal_to_utf8(const afw_dateTime_t *dateTime, const afw_pool_t *p, afw_xctx_t *xctx)
Convert internal dateTime to utf8 xml schema dateTime in specified pool.
Definition: afw_time.c:1081
afw_integer_t afw_time_to_microseconds_utc(const afw_time_t *time, afw_xctx_t *xctx)
Convert time normalize to utc to microseconds.
Definition: afw_time.c:665
const afw_time_t * afw_time_now_utc(const afw_pool_t *p, afw_xctx_t *xctx)
Get now time as time only in specified pool.
Definition: afw_time.c:606
const afw_dateTime_t * afw_dateTime_create_from_apr_time(apr_time_t apr_time, const afw_pool_t *p, afw_xctx_t *xctx)
Create afw_dateTime_t from apr time.
Definition: afw_time.c:324
void afw_time_utf8_set_internal(const afw_utf8_t *utf8, afw_time_t *internal, afw_xctx_t *xctx)
Convert utf8 xml schema dateTime to internal and set.
Definition: afw_time.c:1385
const afw_utf8_t * afw_yearMonthDuration_internal_to_utf8(const afw_yearMonthDuration_t *yearMonthDuration, const afw_pool_t *p, afw_xctx_t *xctx)
Convert internal yearMonthDuration to utf8 xml schema yearMonthDuration in specified pool.
Definition: afw_time.c:1407
const afw_utf8_t * afw_time_internal_to_utf8(const afw_time_t *time, const afw_pool_t *p, afw_xctx_t *xctx)
Convert internal time to utf8 xml schema time in specified pool.
Definition: afw_time.c:1369
void afw_dateTime_subtract_yearMonthDuration(afw_dateTime_t *dateTime, const afw_yearMonthDuration_t *yearMonthDuration, afw_xctx_t *xctx)
Subtract yearMonthDuration from dateTime.
Definition: afw_time.c:2009
const afw_time_t * afw_time_create_from_parts(int hour, int minute, int second, int microsecond, int tz_hours_offset, int tz_minutes_offset, const afw_pool_t *p, afw_xctx_t *xctx)
Create afw_time_t from parts in specific pool.
Definition: afw_time.c:448
void afw_yearMonthDuration_set_from_parts(afw_yearMonthDuration_t *yearMonthDuration, afw_boolean_t is_positive, int years, int months, afw_xctx_t *xctx)
Set afw_yearMonthDuration_t from parts.
Definition: afw_time.c:471
void afw_time_set_from_parts(afw_time_t *time, int hour, int minute, int second, int microsecond, int tz_hours_offset, int tz_minutes_offset, afw_xctx_t *xctx)
Set afw_time_t from parts.
Definition: afw_time.c:425
int afw_date_compare(const afw_date_t *v1, const afw_date_t *v2, afw_xctx_t *xctx)
compare two date values.
Definition: afw_time.c:1517
void afw_dateTime_set_from_apr_time(afw_dateTime_t *dateTime, apr_time_t apr_time, afw_xctx_t *xctx)
Set afw_dateTime_t from apr_time.
Definition: afw_time.c:304
void afw_dateTime_subtract_dayTimeDuration(afw_dateTime_t *dateTime, const afw_dayTimeDuration_t *dayTimeDuration, afw_xctx_t *xctx)
Subtract dayTimeDuration from dateTime.
Definition: afw_time.c:1915
void afw_dateTime_add_yearMonthDuration(afw_dateTime_t *dateTime, const afw_yearMonthDuration_t *yearMonthDuration, afw_xctx_t *xctx)
Add yearMonthDuration to dateTime.
Definition: afw_time.c:1979
int afw_date_maximum_days_in_month(afw_integer_t year, afw_integer_t month)
Determine maximum days in a month.
Definition: afw_time.c:1671
int afw_dateTime_compare(const afw_dateTime_t *v1, const afw_dateTime_t *v2, afw_xctx_t *xctx)
compare two dateTime values.
Definition: afw_time.c:1540
const afw_dateTime_t * afw_dateTime_create_from_parts(int year, int month, int day, int hour, int minute, int second, int microsecond, int tz_hours_offset, int tz_minutes_offset, const afw_pool_t *p, afw_xctx_t *xctx)
Create afw_dateTime_t from parts in specific pool.
Definition: afw_time.c:274
int afw_time_compare(const afw_time_t *v1, const afw_time_t *v2, afw_xctx_t *xctx)
compare two time values.
Definition: afw_time.c:1590
void afw_dateTime_set_now(afw_dateTime_t *dateTime_local, afw_dateTime_t *dateTime_utc, afw_xctx_t *xctx)
Set local and/or utc dateTime to now.
Definition: afw_time.c:523
void afw_dateTime_utf8_set_internal(const afw_utf8_t *utf8, afw_dateTime_t *internal, afw_xctx_t *xctx)
Convert utf8 xml schema dateTime to internal and set.
Definition: afw_time.c:1099
void afw_dayTimeDuration_utf8_set_internal(const afw_utf8_t *utf8, afw_dayTimeDuration_t *internal, afw_xctx_t *xctx)
Convert utf8 xml schema dayTimeDuration to internal and set.
Definition: afw_time.c:1234
const afw_utf8_t * afw_dateType_internal_to_generalized_time(const afw_dateTime_t *dateTime, const afw_pool_t *p, afw_xctx_t *xctx)
Convert internal dateTime to generalized time (see X.208) in specified pool.
Definition: afw_time.c:2039
void afw_dateTime_add_dayTimeDuration(afw_dateTime_t *dateTime, const afw_dayTimeDuration_t *dayTimeDuration, afw_xctx_t *xctx)
Add dayTimeDuration to dateTime.
Definition: afw_time.c:1851
const afw_dateTime_t * afw_dateTime_now_utc(const afw_pool_t *p, afw_xctx_t *xctx)
Get now time as dateTime in specified pool.
Definition: afw_time.c:593
void afw_yearMonthDuration_utf8_set_internal(const afw_utf8_t *utf8, afw_yearMonthDuration_t *internal, afw_xctx_t *xctx)
Convert utf8 xml schema yearMonthDuration to internal and set.
Definition: afw_time.c:1458
date with time zone.
Definition: afw_common.h:1712
date, time, and time zone.
Definition: afw_common.h:1760
dayTime duration
Definition: afw_common.h:1657
Interface afw_pool public struct.
time with time zone.
Definition: afw_common.h:1746
NFC normalized UTF-8 string.
Definition: afw_common.h:545
Interface afw_xctx public struct.
yearMonth duration
Definition: afw_common.h:1646