This file is indexed.

/usr/include/mama/datetime.h is in libmama-dev 2.2.2.1-11.1ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
/* $Id$
 *
 * OpenMAMA: The open middleware agnostic messaging API
 * Copyright (C) 2011 NYSE Technologies, Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */

#ifndef MamaDateTimeH__
#define MamaDateTimeH__

#include <mama/config.h>
#include <mama/status.h>
#include <mama/types.h>
#include <mama/timezone.h>
#include "wombat/port.h"

#include <time.h>


#if defined(__cplusplus)
extern "C" {
#endif


typedef enum mamaDateTimePrecision_
{
    MAMA_DATE_TIME_PREC_SECONDS      = 0,
    MAMA_DATE_TIME_PREC_DECISECONDS  = 1,
    MAMA_DATE_TIME_PREC_CENTISECONDS = 2,
    MAMA_DATE_TIME_PREC_MILLISECONDS = 3,
    MAMA_DATE_TIME_PREC_MICROSECONDS = 6,
    MAMA_DATE_TIME_PREC_DAYS         = 10,
    MAMA_DATE_TIME_PREC_MINUTES      = 12,
    MAMA_DATE_TIME_PREC_UNKNOWN      = 15
} mamaDateTimePrecision;

typedef enum mamaDayOfWeek_
{
    Sunday = 0, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday
} mamaDayOfWeek;


typedef mama_u8_t  mamaDateTimeHints;
#define MAMA_DATE_TIME_HAS_DATE    ((mamaDateTimeHints) 0x01)
#define MAMA_DATE_TIME_HAS_TIME    ((mamaDateTimeHints) 0x02)
#define MAMA_DATE_TIME_NO_TIMEZONE ((mamaDateTimeHints) 0x04)


/**
 * Create a date/time object.
 *
 * @param dateTime The location of a mamaDateTime to store the result
 */
MAMAExpDLL
extern mama_status
mamaDateTime_create (mamaDateTime* dateTime);

/**
 * Destroy a mamaDateTime object.
 *
 * @param dateTime  The date/time object to destroy.
 */
MAMAExpDLL
extern mama_status
mamaDateTime_destroy (mamaDateTime dateTime);

/**
 * Clear a mamaDateTime object.
 *
 * @param dateTime  The date/time object to clear.
 */
MAMAExpDLL
extern mama_status
mamaDateTime_clear (mamaDateTime dateTime);

/**
 * Clear the date part of a mamaDateTime object.
 *
 * @param dateTime  The date/time object to clear (preserving the time of day).
 */
MAMAExpDLL
extern mama_status
mamaDateTime_clearDate (mamaDateTime dateTime);

/**
 * Clear the time of day part of a mamaDateTime object (preserving the date).
 *
 * @param dateTime  The date/time object to clear.
 */
MAMAExpDLL
extern mama_status
mamaDateTime_clearTime (mamaDateTime dateTime);

/*
 * Copy a date/time object.  The destination object must have already
 * been allocated using mamaDateTime_create().
 */
MAMAExpDLL
extern mama_status
mamaDateTime_copy (mamaDateTime       dest,
                   const mamaDateTime src);

/*
 * Check whether the date/time object has been set to anything
 */
MAMAExpDLL
extern int
mamaDateTime_empty (const mamaDateTime dateTime);

/*
 * Check for equality between two date/time objects.
 */
MAMAExpDLL
extern int
mamaDateTime_equal (const mamaDateTime lhs,
                    const mamaDateTime rhs);

/*
 * Compare two date/time objects.  The return value is negative if lhs
 * is earlier than rhs, positive if lhs is greater than rhs and zero
 * if the two are equal.
 */
MAMAExpDLL
extern int
mamaDateTime_compare (const mamaDateTime lhs,
                      const mamaDateTime rhs);

/**
 * Set the date and time as seconds and microseconds since the Epoch
 * (UTC time zone) with an option to designate the accuracy of the
 * time.
 *
 * @param dateTime      The dateTime to set.
 * @param seconds       The number of seconds since the Epoch.
 * @param microseconds  The number of microseconds.
 * @param precision     The precision of the time stamp.
 */
MAMAExpDLL
extern mama_status
mamaDateTime_setEpochTime(mamaDateTime           dateTime,
                          mama_u32_t             seconds,
                          mama_u32_t             microseconds,
                          mamaDateTimePrecision  precision);

/**
 * Set the date and time as seconds (plus, possibly fractional
 * seconds) since the Epoch (UTC time zone).  Fractional seconds will
 * be rounded to microseconds.
 *
 * @param dateTime The dateTime to set.
 * @param seconds  The number of seconds since the Epoch.
 */
MAMAExpDLL
extern mama_status
mamaDateTime_setEpochTimeF64(mamaDateTime dateTime,
                             mama_f64_t   seconds);

/**
 * Set the date and time as milliseconds.
 *
 * @param dateTime The dateTime to set.
 * @param milliseconds  The number of milliseconds since the Epoch.
 */
MAMAExpDLL
extern mama_status
mamaDateTime_setEpochTimeMilliseconds(mamaDateTime dateTime,
                                      mama_u64_t   milliseconds);

/**
 * Set the date and time as microseconds.
 *
 * @param dateTime The dateTime to set.
 * @param milliseconds  The number of microseconds since the Epoch.
 */
MAMAExpDLL
extern mama_status
mamaDateTime_setEpochTimeMicroseconds(mamaDateTime dateTime,
                                      mama_u64_t   milliseconds);

/**
 * Set the date and/or time with special, optional hints to indicate
 * whether the date/time includes date information, time information
 * and/or whether a user of the date/time should consider it in the
 * context of a time zone.
 *
 * @param dateTime      The dateTime to set.
 * @param seconds       The number of seconds (since the Epoch or start-of-day if no date).
 * @param microseconds  The number of microseconds.
 * @param precision     The precision of the date/time stamp.
 * @param hints         Additional hints
 */
MAMAExpDLL
extern mama_status
mamaDateTime_setWithHints(mamaDateTime           dateTime,
                          mama_u32_t             seconds,
                          mama_u32_t             microseconds,
                          mamaDateTimePrecision  precision,
                          mamaDateTimeHints      hints);

/**
 * Set the precision hint.
 *
 * @param dateTime      The dateTime to set.
 * @param precision     The precision of the date/time stamp.
 */
MAMAExpDLL
extern mama_status
mamaDateTime_setPrecision(mamaDateTime           dateTime,
                          mamaDateTimePrecision  precision);

/**
 * Set the date and time to the current UTC time.  Precision and hints
 * will be set appropriately.
 *
 * @param dateTime      The dateTime to set.
 */
MAMAExpDLL
extern mama_status
mamaDateTime_setToNow(mamaDateTime dateTime);

/**
 * Set the dateTime object to 12am of the current date in the timezone
 * provided (or UTC if NULL).
 *
 * @param dateTime  The dateTime to set.
 * @param tz        The timezone in which the date will be set.
 */
MAMAExpDLL
extern mama_status
mamaDateTime_setToMidnightToday(mamaDateTime       dateTime,
                                const mamaTimeZone tz);

/**
 * Set the entire date and time for the MamaDateTime.  The year,
 * month and day parameters must all be integers greater than
 * zero.
 *
 * @param dateTime      The dateTime to set.
 * @param year          The year (must be 1970 or later).
 * @param month         The month (1 - 12).
 * @param day           The day (1 - 31).
 * @param hour          The hour (0 - 23).
 * @param minute        The minute (0 - 59).
 * @param second        The second (0 - 59).
 * @param microsecond   The second (0 - 999999).
 * @param precision     An explicit precision, if known.
 * @param tz            A timezone to shift from.
 */
MAMAExpDLL
extern mama_status
mamaDateTime_setWithPrecisionAndTz(mamaDateTime           dateTime,
                                   mama_u32_t             year,
                                   mama_u32_t             month,
                                   mama_u32_t             day,
                                   mama_u32_t             hour,
                                   mama_u32_t             minute,
                                   mama_u32_t             second,
                                   mama_u32_t             microsecond,
                                   mamaDateTimePrecision  precision,
                                   const mamaTimeZone     tz);

/**
 * Set the time-of-day portion of the MamaDateTime.  The date
 * portion is not affected.
 *
 * @param dateTime      The dateTime to set.
 * @param hour          The hour (0 - 23).
 * @param minute        The minute (0 - 59).
 * @param second        The second (0 - 59).
 * @param microsecond   The microsecond (0 - 999999).
 */
MAMAExpDLL
extern mama_status
mamaDateTime_setTime(mamaDateTime dateTime,
                     mama_u32_t   hour,
                     mama_u32_t   minute,
                     mama_u32_t   second,
                     mama_u32_t   microsecond);

/**
 * Set the time-of-day portion of the MamaDateTime with explicit
 * precision.  The date portion is not affected.
 *
 * @param dateTime      The dateTime to set.
 * @param hour          The hour (0 - 23).
 * @param minute        The minute (0 - 59).
 * @param second        The second (0 - 59).
 * @param microsecond   The microsecond (0 - 999999).
 * @param precision     An explicit precision, if known.
 * @param tz            A timezone to shift from.
 */
MAMAExpDLL
extern mama_status
mamaDateTime_setTimeWithPrecisionAndTz(mamaDateTime           dateTime,
                                       mama_u32_t             hour,
                                       mama_u32_t             minute,
                                       mama_u32_t             second,
                                       mama_u32_t             microsecond,
                                       mamaDateTimePrecision  precision,
                                       const mamaTimeZone     tz);

/**
 * Set the date portion of the MamaDateTime.  The time-of-day
 * portion is not affected.
 *
 * @param dateTime      The dateTime to set.
 * @param year          The year (must be 1970 or later).
 * @param month         The month (1 - 12).
 * @param day           The day (1 - 31).
 */
MAMAExpDLL
extern mama_status
mamaDateTime_setDate(mamaDateTime dateTime,
                     mama_u32_t   year,
                     mama_u32_t   month,
                     mama_u32_t   day);

/**
 * Copy the time-of-day portion of the mamaDateTime.  The date
 * portion is not affected.
 *
 * @param dest      The dateTime to copy to.
 * @param src       The dateTime to copy from.
 */
MAMAExpDLL
extern mama_status
mamaDateTime_copyTime (mamaDateTime       dest,
                       const mamaDateTime src);

/**
 * Copy the date portion of the mamaDateTime.  The time-of-day
 * portion is not affected.
 *
 * @param dest      The dateTime to copy to.
 * @param src       The dateTime to copy from.
 */
MAMAExpDLL
extern mama_status
mamaDateTime_copyDate (mamaDateTime       dest,
                       const mamaDateTime src);

/**
 * Determine whether the time-of-day portion of the MamaDateTime is set.
 *
 * @param dateTime  The dateTime to check.
 * @param result    Address of a bool to store the result. 0 false.
 */
MAMAExpDLL
extern mama_status
mamaDateTime_hasTime(const mamaDateTime dateTime,
                     mama_bool_t*       result);

/**
 * Determine whether the date portion of the MamaDateTime is set.
 *
 * @param dateTime  The dateTime to check.
 * @param result    Address of mama_bool_t to store the result. 0 false.
 */
MAMAExpDLL
extern mama_status
mamaDateTime_hasDate(const mamaDateTime dateTime,
                     mama_bool_t*       result);

/**
 * Add a number of seconds, including fractional seconds (may be negative).
 *
 * @param dateTime      The dateTime to set.
 * @param seconds       The number of seconds to add (or subtract).
 */
MAMAExpDLL
extern mama_status
mamaDateTime_addSeconds(mamaDateTime dateTime,
                        mama_f64_t   seconds);

/**
 * Add a number of whole seconds (may be negative).
 *
 * @param dateTime      The dateTime to set.
 * @param seconds       The number of seconds to add (or subtract).
 */
MAMAExpDLL
extern mama_status
mamaDateTime_addWholeSeconds(mamaDateTime dateTime,
                             mama_i32_t   seconds);

/**
 * Add a number of microseconds (may be negative)
 * Add a number of microseconds (may be negative and greater than
 * 1000000 or less than -1000000).
 *
 * @param dateTime      The dateTime to set.
 * @param microseconds The number of microseconds to add. Can be positive
 * or negative. Note that there are no restrictions on the magnitude of
 * this value.
 */
MAMAExpDLL
extern mama_status
mamaDateTime_addMicroseconds(mamaDateTime dateTime,
                             mama_i64_t   microseconds);

/**
 * Set the date and time from a string representation of format
 * YYYY-mm-dd HH:MM:SS.mmmmmm.  (YYYY/mm/dd also works.)  The
 * precision of subseconds is determined by the number of digits
 * after the decimal point.
 *
 * @param dateTime The dateTime to set.
 * @param str      The string representation of some date and/or time.
 */
MAMAExpDLL
extern mama_status
mamaDateTime_setFromString(mamaDateTime dateTime,
                           const char*  str);

/**
 * Set the date and time from a string representation of format
 * YYYY-mm-dd HH:MM:SS.mmmmmm.  (YYYY/mm/dd also works.)  The
 * precision of subseconds is determined by the number of digits after
 * the decimal point.  If tz is not NULL, the time string is assumed
 * to be set in a different time zone and will be adjusted to UTC
 * accordingly.
 *
 * @param dateTime The dateTime to set.
 * @param str      The string representation of some date and/or time.
 * @param tz       A timezone to shift from.
 */
MAMAExpDLL
extern mama_status
mamaDateTime_setFromStringWithTz(mamaDateTime        dateTime,
                                 const char*         str,
                                 const mamaTimeZone  tz);

/**
 * Set the date and time from an unterminated string representation of
 * format YYYY-mm-dd HH:MM:SS.mmmmmm.  (YYYY/mm/dd also works.)  The
 * precision of subseconds is determined by the number of digits after
 * the decimal point.
 *
 * @param dateTime  The dateTime to set.
 * @param str       The string representation of some date and/or time.
 * @param strLen    The length of the unterminated string date/time.
 */
MAMAExpDLL
extern mama_status
mamaDateTime_setFromStringBuffer(mamaDateTime dateTime,
                                 const char*  str,
                                 mama_size_t  strLen);

/**
 * Set the date and time from an unterminated string representation of
 * format YYYY-mm-dd HH:MM:SS.mmmmmm.  (YYYY/mm/dd also works.)  The
 * precision of subseconds is determined by the number of digits after
 * the decimal point.  If tz is not NULL, the time string is assumed
 * to be set in a different time zone and will be adjusted to UTC
 * accordingly.
 *
 * @param dateTime  The dateTime to set.
 * @param str       The string representation of some date and/or time.
 * @param strLen    The length of the unterminated string date/time.
 * @param tz        A timezone to shift from.
 */
MAMAExpDLL
extern mama_status
mamaDateTime_setFromStringBufferWithTz(mamaDateTime       dateTime,
                                       const char*        str,
                                       mama_size_t        strLen,
                                       const mamaTimeZone tz);

/**
 * Get the date and time as seconds and microseconds since the Epoch
 * (UTC time zone).
 *
 * @param dateTime The dateTime to set.
 * @param seconds  The number of seconds since the Epoch.
 * @param microseconds  The number of additional microseconds.
 * @param precision The precision of the returned time value.
 */
MAMAExpDLL
extern mama_status
mamaDateTime_getEpochTime(const mamaDateTime     dateTime,
                          mama_u32_t*            seconds,
                          mama_u32_t*            microseconds,
                          mamaDateTimePrecision* precision);
    
/**
 * Get the date and time as seconds and microseconds since the Epoch
 * in the timezone supplied. 
 *
 * @param dateTime The dateTime to set.
 * @param seconds  The number of seconds since the Epoch.
 * @param microseconds  The number of additional microseconds.
 * @param precision The precision of the returned time value.
 * @param tz The timezone for the returned values.
 */
MAMAExpDLL
extern mama_status
mamaDateTime_getEpochTimeWithTz(const mamaDateTime     dateTime,
                                mama_u32_t*            seconds,
                                mama_u32_t*            microseconds,
                                mamaDateTimePrecision* precision,
                                const mamaTimeZone     tz);

/**
 * Get the date and time as microseconds since the Epoch, (using the UTC timezone).
 *
 * @param[in] 	dateTime 		The dateTime to obtain the number of microseconds from.
 * @param[out] 	microseconds  	The number of microseconds since the Epoch.
 * @return Indicates whether the function succeeded or failed and could be one of:
 *				- MAMA_STATUS_INVALID_ARG
 *				- MAMA_STATUS_OK
 */
MAMAExpDLL
extern mama_status
mamaDateTime_getEpochTimeMicroseconds(const mamaDateTime dateTime,
                                      mama_u64_t*        microseconds);

/**
 * Get the date and time as microseconds since the Epoch in the supplied
 * time zone.
 *
 * @param[in] 	dateTime 		The dateTime to obtain the number of microseconds from.
 * @param[out] 	microseconds  	The number of microseconds since the Epoch.
 * @param[int] 	tz 			 	The timezone.
 * @return Indicates whether the function succeeded or failed and could be one of:
 *				- MAMA_STATUS_INVALID_ARG
 *				- MAMA_STATUS_OK
 */
MAMAExpDLL
extern mama_status
mamaDateTime_getEpochTimeMicrosecondsWithTz(const mamaDateTime dateTime,
                                            mama_u64_t*        microseconds,
                                            const mamaTimeZone tz);
    
/**
 * Get the date and time as milliseconds since the Epoch (UTC time
 * zone).
 *
 * @param dateTime The dateTime to set.
 * @param milliseconds  The number of milliseconds since the Epoch.
 */
MAMAExpDLL
extern mama_status
mamaDateTime_getEpochTimeMilliseconds(const mamaDateTime dateTime,
                                      mama_u64_t*        milliseconds);

/**
 * Get the date and time as milliseconds since the Epoch in the 
 * timezone supplied.
 *
 * @param dateTime The dateTime to set.
 * @param milliseconds  The number of milliseconds since the Epoch.
 * @param tz The timezone for the returned values. 
 */
MAMAExpDLL
extern mama_status
mamaDateTime_getEpochTimeMillisecondsWithTz(const mamaDateTime dateTime,
                                            mama_u64_t*        milliseconds,
                                            const mamaTimeZone tz);
    
/**
 * Get the date and time as seconds since the Epoch (UTC time
 * zone).
 *
 * @param dateTime The dateTime to set
 * @param seconds The number of seconds (including partial seconds) since the Epoch.
 */
MAMAExpDLL
extern mama_status
mamaDateTime_getEpochTimeSeconds(const mamaDateTime dateTime,
                                 mama_f64_t*        seconds);

/**
 * Get the date and time as seconds since the Epoch, (using the UTC timezone). 
 * If no date value is contained in the dateTime then it will be set to today's date
 * and the calculation made.
 *
 * @param[in] 	dateTime 	The dateTime to obtain the number of microseconds from.
 * @param[out] 	seconds 	The number of seconds, (including partial seconds), since the Epoch.
 * @return Indicates whether the function succeeded or failed and could be one of:
 *				- MAMA_STATUS_INVALID_ARG
 *				- MAMA_STATUS_SYSTEM_ERROR
 *				- MAMA_STATUS_NULL_ARG
 *				- MAMA_STATUS_OK
 */
MAMAExpDLL
extern mama_status
mamaDateTime_getEpochTimeSecondsWithCheck(const mamaDateTime dateTime,
                                          mama_f64_t*        seconds);

/**
 * Get the date and time as seconds since the Epoch in the 
 * timezone supplied.
 *
 * @param dateTime The dateTime to set
 * @param seconds The number of seconds (including partial seconds) since the
 * Epoch.
 * @param tz The timezone for the returned values. 
 */
MAMAExpDLL
extern mama_status
mamaDateTime_getEpochTimeSecondsWithTz(const mamaDateTime dateTime,
                                       mama_f64_t*        seconds,
                                       const mamaTimeZone tz);
    
/**
 * Get the date and/or time with special, optional hints to indicate
 * whether the date/time includes date information, time information
 * and/or whether a user of the date/time should consider it in the
 * context of a time zone.
 *
 * @param dateTime      The dateTime to set.
 * @param seconds       The number of seconds (since the Epoch or start-of-day if no date).
 * @param microseconds  The number of microseconds.
 * @param precision     The precision of the date/time stamp.
 * @param hints         Additional hints
 */
MAMAExpDLL
extern mama_status
mamaDateTime_getWithHints(const mamaDateTime     dateTime,
                          mama_u32_t*            seconds,
                          mama_u32_t*            microseconds,
                          mamaDateTimePrecision* precision,
                          mama_u8_t*             hints);

/**
 * Get the date/time as a "struct timeval".
 *
 * @param dateTime The dateTime to set.
 * @param result   The struct timeval to fill in.
 */
MAMAExpDLL
extern mama_status
mamaDateTime_getStructTimeVal(const mamaDateTime dateTime,
                              struct timeval*    result);

/**
 * Get the date/time as a "struct timeval" in the timezone supplied.
 *
 * @param dateTime The dateTime to set.
 * @param result   The struct timeval to fill in.
 * @param tz The timezone for the returned values. 
 */
MAMAExpDLL
extern mama_status
mamaDateTime_getStructTimeValWithTz(const mamaDateTime dateTime,
                                    struct timeval*    result,
                                    const mamaTimeZone tz);
    
/**
 * Get the date/time as a "struct tm".
 *
 * @param dateTime The dateTime to set.
 * @param result   The struct timeval to fill in.
 */
MAMAExpDLL
extern mama_status
mamaDateTime_getStructTm(const mamaDateTime dateTime,
                         struct tm*         result);

/**
 * Get the date/time as a "struct tm" in the timezone supplied.
 *
 * @param dateTime The dateTime to set.
 * @param result   The struct timeval to fill in.
 * @param tz The timezone for the returned values. 
 
 */
MAMAExpDLL
extern mama_status
mamaDateTime_getStructTmWithTz(const mamaDateTime dateTime,
                               struct tm*         result,
                               const mamaTimeZone tz);
    
/**
 * Get the date and/or time as a string.  If no date information is
 * available, no date is printed in the resulting string.  The format
 * for dates is YYYY-mm-dd (the ISO 8601 date format) and the format
 * for times is HH:MM:SS.mmmmmmm (where the precision of the
 * subseconds may vary depending upon any precision hints available).
 *
 * @param dateTime      The dateTime to set.
 * @param str           The string buffer to update.
 * @param maxLen        The maximum size of the string buffer (including
 * trailing '\\0').
 */
MAMAExpDLL
extern mama_status
mamaDateTime_getAsString(const mamaDateTime dateTime,
                         char*              str,
                         mama_size_t        maxLen);

/**
 * Get the time (no date) as a string.  The format for times is
 * HH:MM:SS.mmmmmmm (where the precision of the subseconds may vary
 * depending upon any precision hints available).
 *
 * @param dateTime      The dateTime to set.
 * @param str           The string buffer to update.
 * @param maxLen        The maximum size of the string buffer (including
 * trailing '\\0').
 */
MAMAExpDLL
extern mama_status
mamaDateTime_getTimeAsString(const mamaDateTime dateTime,
                             char*              str,
                             mama_size_t        maxLen);

/**
 * Get the date (no time) as a string.  The format
 * for dates is YYYY-mm-dd (the ISO 8601 date format).
 *
 * @param dateTime      The dateTime to set.
 * @param str           The string buffer to update.
 * @param maxLen        The maximum size of the string buffer (including
 * trailing '\\0').
 */
MAMAExpDLL
extern mama_status
mamaDateTime_getDateAsString(const mamaDateTime dateTime,
                             char*              str,
                             mama_size_t        maxLen);

/**
 * Get the date and/or time as a string using the format provided.
 * The format string can be the common ones supported by strftime()
 * (%Y, %m, %d, %F, %T, %Y, %H, %M, %S, %B, %b, %h, ), with the
 * additional format strings, "%:" and "%;", which represents the
 * number of subseconds in millis. "%;" includes the dot and only prints the
 * subseconds if they are non-zero. "%:" does not include the dot, and 
 * prints "000" for 0 milliseconds. "%." and "%," are identical to "%:" and "%;" 
 * except they use the internal precision field to determine how many decimal 
 * places to print.
 *
 *
 * @param dateTime      The dateTime to set.
 * @param str           The string buffer to update.
 * @param maxLen        The maximum size of the string buffer (including
 * trailing '\\0').
 * @param format        The output format.
 */
MAMAExpDLL
extern mama_status
mamaDateTime_getAsFormattedString(const mamaDateTime dateTime,
                                  char*              str,
                                  mama_size_t        maxLen,
                                  const char*        format);

/**
 * Get the date and/or time as a string using the format provided.
 * The format string can be the common ones supported by strftime()
 * (%Y, %m, %d, %F, %T, %Y, %H, %M, %S, %B, %b, %h, ), with the
 * additional format strings, "%:" and "%;", which represents the
 * number of subseconds in millis. "%;" includes the dot and only prints the
 * subseconds if they are non-zero. "%:" does not include the dot, and 
 * prints "000" for 0 milliseconds. "%." and "%," are identical to "%:" and "%;" 
 * except they use the internal precision field to determine how many decimal 
 * places to print.
 *
 * @param dateTime      The dateTime to set.
 * @param str           The string buffer to update.
 * @param maxLen        The maximum size of the string buffer (including
 * trailing '\\0').
 * @param format        The output format.
 * @param tz            The timezone for the returned date/time.
 */
MAMAExpDLL
extern mama_status
mamaDateTime_getAsFormattedStringWithTz(const mamaDateTime dateTime,
                                        char*              str,
                                        mama_size_t        maxLen,
                                        const char*        format,
                                        const mamaTimeZone tz);

/**
 * Get the year (1970 onwards).
 *
 * @param dateTime      The dateTime from which to get the result.
 * @param result        The result of the get method.
 */
MAMAExpDLL
extern mama_status
mamaDateTime_getYear(const mamaDateTime dateTime,
                     mama_u32_t*        result);

/**
 * Get the month (1-12).
 *
 * @param dateTime      The dateTime from which to get the result.
 * @param result        The result of the get method.
 */
MAMAExpDLL
extern mama_status
mamaDateTime_getMonth(const mamaDateTime dateTime,
                      mama_u32_t*        result);

/**
 * Get the day of month (1-31).
 *
 * @param dateTime      The dateTime from which to get the result.
 * @param result        The result of the get method.
 */
MAMAExpDLL
extern mama_status
mamaDateTime_getDay(const mamaDateTime dateTime,
                    mama_u32_t*        result);

/**
 * Get the hour (0-23).
 *
 * @param dateTime      The dateTime from which to get the result.
 * @param result        The result of the get method.
 */
MAMAExpDLL
extern mama_status
mamaDateTime_getHour(const mamaDateTime dateTime,
                     mama_u32_t*        result);

/**
 * Get the minute (0-59).
 *
 * @param dateTime      The dateTime from which to get the result.
 * @param result        The result of the get method.
 */
MAMAExpDLL
extern mama_status
mamaDateTime_getMinute(const mamaDateTime dateTime,
                       mama_u32_t*        result);

/**
 * Get the second (0-59).
 *
 * @param dateTime      The dateTime from which to get the result.
 * @param result        The result of the get method.
 */
MAMAExpDLL
extern mama_status
mamaDateTime_getSecond(const mamaDateTime dateTime,
                       mama_u32_t*        result);

/**
 * Get the microsecond (0-999999).
 *
 * @param dateTime      The dateTime from which to get the result.
 * @param result        The result of the get method.
 */
MAMAExpDLL
extern mama_status
mamaDateTime_getMicrosecond(const mamaDateTime dateTime,
                            mama_u32_t*        result);

/**
 * Get the day of week.
 *
 * @param dateTime      The dateTime from which to get the result.
 * @param result        The result of the get method.
 */
MAMAExpDLL
extern mama_status
mamaDateTime_getDayOfWeek(const mamaDateTime dateTime,
                          mamaDayOfWeek*     result);

/**
 * Return the difference, in seconds (including fractions of seconds),
 * between the two times.
 */
MAMAExpDLL
extern mama_status
mamaDateTime_diffSeconds(const mamaDateTime t1,
                         const mamaDateTime t0,
                         mama_f64_t*        result);

/**
 * Return the difference, in seconds (including fractions of seconds),
 * between the two times, ignoring any date information.
 */
MAMAExpDLL
extern mama_status
mamaDateTime_diffSecondsSameDay(const mamaDateTime t1,
                                const mamaDateTime t0,
                                mama_f64_t*        result);

/**
 * Return the difference, in microseconds, between the two times.
 */
MAMAExpDLL
extern mama_status
mamaDateTime_diffMicroseconds(const mamaDateTime t1,
                              const mamaDateTime t0,
                              mama_i64_t*        result);


#if defined(__cplusplus)
}
#endif

#endif