blob: e9ebcbdf9b05657f88ff505ebb11004cf660509e [file] [log] [blame]
Alexandre Lisionddd731e2014-01-31 11:50:08 -05001// Copyright (C) 2006-2010 David Sugar, Tycho Softworks.
2//
3// This file is part of GNU uCommon C++.
4//
5// GNU uCommon C++ is free software: you can redistribute it and/or modify
6// it under the terms of the GNU Lesser General Public License as published
7// by the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// GNU uCommon C++ is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU Lesser General Public License for more details.
14//
15// You should have received a copy of the GNU Lesser General Public License
16// along with GNU uCommon C++. If not, see <http://www.gnu.org/licenses/>.
17
18/**
19 * Basic classes for manipulating time and date based data, particularly
20 * that may be in strings.
21 * @file ucommon/datetime.h
22 */
23
24/**
25 * Example of date & time manipulation.
26 * @example datetime.cpp
27 */
28
29#ifndef _UCOMMON_DATETIME_H_
30#define _UCOMMON_DATETIME_H_
31
32#ifndef _UCOMMON_CONFIG_H_
33#include <ucommon/platform.h>
34#endif
35
36#ifndef _UCOMMON_NUMBERS_H_
37#include <ucommon/numbers.h>
38#endif
39
40#ifndef _UCOMMON_STRING_H_
41#include <ucommon/string.h>
42#endif
43
44#ifndef _MSWINDOWS_
45#include <unistd.h>
46#include <sys/time.h>
47#endif
48
49#include <time.h>
50
51#define DATE_STRING_SIZE 10
52#define DATE_BUFFER_SIZE 11
53#define TIME_STRING_SIZE 8
54#define TIME_BUFFER_SIZE 9
55#define DATETIME_STRING_SIZE 19
56#define DATETIME_BUFFER_SIZE 20
57
58/**
59 * Convenience type for struct tm.
60 */
61typedef struct tm tm_t;
62
63NAMESPACE_UCOMMON
64
65#ifdef __BORLANDC__
66 using std::tm;
67 using std::time_t;
68#endif
69
70/**
71 * The Date class uses a julian date representation of the current
72 * year, month, and day. This is then manipulated in several forms
73 * and may be exported as needed.
74 *
75 * @author David Sugar <dyfet@ostel.com>
76 * @short julian number based date class.
77 */
78class __EXPORT Date
79{
80protected:
81 long julian;
82
83 void set(long year, long month, long day);
84
85 /**
86 * A method to use to "post" any changed values when shadowing
87 * a mixed object class. This is used by DateNumber and string classes.
88 */
89 virtual void update(void);
90
91public:
92 /**
93 * Size of date string field.
94 */
95 static const size_t sz_string;
96
97 /**
98 * Create a julian date from a time_t type.
99 * @param value from time()
100 */
101 Date(time_t value);
102
103 /**
104 * Create a julian date from a local or gmt date and time.
105 * @param object from DateTime::glt() or gmt().
106 */
107 Date(struct tm *object);
108
109 /**
110 * Create a julian date from a ISO date string of a specified size.
111 * @param pointer to ISO date string.
112 * @param size of date field if not null terminated.
113 */
114 Date(const char *pointer, size_t size = 0);
115
116 /**
117 * Create a julian date from an arbitrary year, month, and day.
118 * @param year of date.
119 * @param month of date (1-12).
120 * @param day of month (1-31).
121 */
122 Date(int year, unsigned month, unsigned day);
123
124 /**
125 * Create a julian date object from another object.
126 * @param object to copy.
127 */
128 Date(const Date& object);
129
130 /**
131 * Construct a new julian date with today's date.
132 */
133 Date();
134
135 /**
136 * Destroy julian date object.
137 */
138 virtual ~Date();
139
140 /**
141 * Get the year of the date.
142 * @return year of the date
143 */
144 int year(void) const;
145
146 /**
147 * Get the month of the date (1-12).
148 * @return month of year
149 */
150 unsigned month(void) const;
151
152 /**
153 * Get the day of the month of the date.
154 * @return day of month
155 */
156 unsigned day(void) const;
157
158 /**
159 * Get the day of the week (0-7).
160 * @return day of week
161 */
162 unsigned dow(void) const;
163
164 /**
165 * Get a ISO string representation of the date (yyyy-mm-dd).
166 * @param buffer to store string.
167 * @return string representation.
168 */
169 const char *put(char *buffer) const;
170
171 /**
172 * Get a time_t for the julian date if in time_t epoch.
173 * @return time_t or -1 if out of range.
174 */
175 time_t timeref(void) const;
176
177 /**
178 * Get the date as a number for the object or 0 if invalid.
179 * @return date as number.
180 */
181 long get(void) const;
182
183 /**
184 * Set (update) the date with current date.
185 */
186 void set(void);
187
188 /**
189 * Set the julian date based on an ISO date string of specified size.
190 * @param pointer to date string field.
191 * @param size of field if not null terminated.
192 */
193 void set(const char *pointer, size_t size = 0);
194
195 /**
196 * Check if date is valid.
197 * @return true if julian date is valid.
198 */
199 bool is_valid(void) const;
200
201 /**
202 * Casting operator to return date as number.
203 * @return julian number.
204 */
205 inline operator long() const
206 {return get();};
207
208 /**
209 * Access julian value.
210 * @return julian number of object.
211 */
212 inline long operator*() const
213 {return get();};
214
215 /**
216 * Expression operator to return an ISO date string for the current
217 * julian date.
218 * @return ISO date string.
219 */
220 String operator()() const;
221
222 /**
223 * Increment date by one day.
224 * @return instance of current date object.
225 */
226 Date& operator++();
227
228 /**
229 * Decrement date by one day.
230 * @return instance of current date object.
231 */
232 Date& operator--();
233
234 /**
235 * Increment date by offset.
236 * @param offset to add to julian date.
237 * @return instance of current date object.
238 */
239 Date& operator+=(long offset);
240
241 /**
242 * Decrement date by offset.
243 * @param offset to subtract from julian date.
244 * @return instance of current date object.
245 */
246 Date& operator-=(long offset);
247
248 /**
249 * Add days to julian date in an expression.
250 * @param days to add.
251 * @return new date object with modified days.
252 */
253 Date operator+(long days);
254
255 /**
256 * Subtract days from a julian date in an expression.
257 * @param days to subtract.
258 * @return new date object with modified days.
259 */
260 Date operator-(long days);
261
262 /**
263 * Operator to compute number of days between two dates.
264 * @param date offset for computation.
265 * @return number of days difference.
266 */
267 inline long operator-(const Date &date)
268 {return (julian - date.julian);};
269
270 /**
271 * Assign date from another date object.
272 * @param date object to assign from.
273 * @return current modified date object.
274 */
275 Date& operator=(const Date& date);
276
277 /**
278 * Compare julian dates if same date.
279 * @param date to compare with.
280 * @return true if same.
281 */
282 bool operator==(const Date& date) const;
283
284 /**
285 * Compare julian dates if not same date.
286 * @param date to compare with.
287 * @return true if not same.
288 */
289 bool operator!=(const Date& date) const;
290
291 /**
292 * Compare julian date if earlier than another date.
293 * @param date to compare with.
294 * @return true if earlier.
295 */
296 bool operator<(const Date& date) const;
297
298 /**
299 * Compare julian date if earlier than or equal to another date.
300 * @param date to compare with.
301 * @return true if earlier or same.
302 */
303 bool operator<=(const Date& date) const;
304
305 /**
306 * Compare julian date if later than another date.
307 * @param date to compare with.
308 * @return true if later.
309 */
310 bool operator>(const Date& date) const;
311
312 /**
313 * Compare julian date if later than or equal to another date.
314 * @param date to compare with.
315 * @return true if later or same.
316 */
317 bool operator>=(const Date& date) const;
318
319 /**
320 * Check if julian date is not valid.
321 * @return true if date is invalid.
322 */
323 inline bool operator!() const
324 {return !is_valid();};
325
326 /**
327 * Check if julian date is valid for is() expression.
328 * @return true if date is valid.
329 */
330 inline operator bool() const
331 {return is_valid();};
332};
333
334/**
335 * The Time class uses a integer representation of the current
336 * time. This is then manipulated in several forms and may be
337 * exported as needed. The time object can represent an instance in
338 * time (hours, minutes, and seconds) in a 24 hour period or can
339 * represent a duration. Millisecond accuracy can be offered.
340 *
341 * @author Marcelo Dalmas <mad@brasmap.com.br> and David Sugar <dyfet@gnutelephony.org>
342 * @short Integer based time class.
343 */
344
345class __EXPORT Time
346{
347protected:
348 long seconds;
349
350protected:
351 virtual void update(void);
352
353public:
354 void set(int hour, int minute = 0, int second = 0);
355
356 /**
357 * Constant for number of seconds in a day.
358 */
359 static const long c_day;
360
361 /**
362 * Constant for number of seconds in a hour.
363 */
364 static const long c_hour;
365
366 /**
367 * Constant for number of seconds in a week.
368 */
369 static const long c_week;
370
371 /**
372 * Size of time string field.
373 */
374 static const size_t sz_string;
375
376 /**
377 * Create a time from the time portion of a time_t.
378 * @param value of time_t to use.
379 */
380 Time(time_t value);
381
382 /**
383 * Create a time from the time portion of a date and time object.
384 * @param object from DateTime::glt() or gmt().
385 */
386 Time(tm_t *object);
387
388 /**
389 * Create a time from a hh:mm:ss formatted time string.
390 * @param pointer to formatted time field.
391 * @param size of field if not null terminated.
392 */
393 Time(const char *pointer, size_t size = 0);
394
395 /**
396 * Create a time from hours (0-23), minutes (0-59), and seconds (0-59).
397 * @param hour of time.
398 * @param minute of time.
399 * @param second of time.
400 */
401 Time(int hour, int minute, int second);
402
403 /**
404 * Create a time object from another object.
405 * @param object to copy.
406 */
407 Time(const Time& object);
408
409 /**
410 * Create a time from current time.
411 */
412 Time();
413
414 /**
415 * Destroy time object.
416 */
417 virtual ~Time();
418
419 /**
420 * Get current time in seconds from midnight.
421 * @return seconds from midnight.
422 */
423 long get(void) const;
424
425 /**
426 * Get hours from midnight.
427 * @return hours from midnight.
428 */
429 int hour(void) const;
430
431 /**
432 * Get minutes from current hour.
433 * @return minutes from current hour.
434 */
435 int minute(void) const;
436
437 /**
438 * Get seconds from current minute.
439 * @return seconds from current minute.
440 */
441 int second(void) const;
442
443 /**
444 * Get a hh:mm:ss formatted string for current time.
445 * @param buffer to store time string in.
446 * @return time string buffer or NULL if invalid.
447 */
448 const char *put(char *buffer) const;
449
450 /**
451 * Set (update) the time with current time.
452 */
453 void set(void);
454
455 /**
456 * Set time from a hh:mm:ss formatted string.
457 * @param pointer to time field.
458 * @param size of field if not null terminated.
459 */
460 void set(const char *pointer, size_t size = 0);
461
462 /**
463 * Check if time object had valid value.
464 * @return true if object is valid.
465 */
466 bool is_valid(void) const;
467
468 /**
469 * Check if time object has valid value for is() operator.
470 * @return true if object is valid.
471 */
472 inline operator bool() const
473 {return is_valid();};
474
475 /**
476 * Check if time object has valid value for ! operator.
477 * @return true if object is not valid.
478 */
479 inline bool operator!() const
480 {return !is_valid();};
481
482 /**
483 * Get difference (in seconds) between two times.
484 * @param reference time to get difference from.
485 * @return difference in seconds.
486 */
487 long operator-(const Time &reference);
488
489 /**
490 * Add seconds to the current time, wrap if 24 hours.
491 * @param seconds to add.
492 * @return new time object with modified value.
493 */
494 Time operator+(long seconds);
495
496 /**
497 * Subtract seconds to the current time, wrap if 24 hours.
498 * @param seconds to subtract.
499 * @return new time object with modified value.
500 */
501 Time operator-(long seconds);
502
503 /**
504 * Get time in seconds.
505 * @return seconds.
506 */
507 inline operator long()
508 {return get();};
509
510 /**
511 * Get object time in seconds.
512 * @return time in seconds.
513 */
514 inline long operator*() const
515 {return get();};
516
517 /**
518 * Convert to standard 24 hour time string.
519 * @return time string.
520 */
521 String operator()() const;
522
523 /**
524 * Incrememnt time by 1 second, wrap on 24 hour period.
525 * @return modified instance of current time object.
526 */
527 Time& operator++();
528
529 /**
530 * Decrement time by 1 second, wrap on 24 hour period.
531 * @return modified instance of current time object.
532 */
533 Time& operator--();
534
535 /**
536 * Assign a time as a copy of another time.
537 * @param time to assign from.
538 * @return time object that was assigned.
539 */
540 Time& operator=(const Time& time);
541
542 /**
543 * Increment time by specified seconds. Wraps on 24 hour period.
544 * @param seconds to add to current time.
545 * @return modified instance of current time object.
546 */
547 Time& operator+=(long seconds);
548
549 /**
550 * Decrement time by specified seconds. Wraps on 24 hour period.
551 * @param seconds to subtract from current time.
552 * @return modified instance of current time object.
553 */
554 Time& operator-=(long seconds);
555
556 /**
557 * Compare time with another time to see if same time.
558 * @param time to compare with.
559 * @return true if same time.
560 */
561 bool operator==(const Time &time) const;
562
563 /**
564 * Compare time with another time to see if not same time.
565 * @param time to compare with.
566 * @return true if not same time.
567 */
568 bool operator!=(const Time &time) const;
569
570 /**
571 * Compare time if earlier than another time.
572 * @param time object to compare with.
573 * @return true if earlier than object.
574 */
575 bool operator<(const Time &time) const;
576
577 /**
578 * Compare time if earlier than or equal to another time.
579 * @param time object to compare with.
580 * @return true if earlier or same as object.
581 */
582 bool operator<=(const Time &time) const;
583
584 /**
585 * Compare time if later than another time.
586 * @param time object to compare with.
587 * @return true if later than object.
588 */
589 bool operator>(const Time &time) const;
590
591 /**
592 * Compare time if later than or equal to another time.
593 * @param time object to compare with.
594 * @return true if later than or same as object.
595 */
596 bool operator>=(const Time &time) const;
597};
598
599/**
600 * The Datetime class uses a julian date representation of the current
601 * year, month, and day and a integer representation of the current
602 * time. This is then manipulated in several forms
603 * and may be exported as needed.
604 *
605 * @author Marcelo Dalmas <mad@brasmap.com.br>
606 * @short Integer based time class.
607 */
608class __EXPORT DateTime : public Date, public Time
609{
610protected:
611 void update(void);
612
613public:
614 /**
615 * Size of datetime string field.
616 */
617 static const size_t sz_string;
618
619 /**
620 * Construct a date and time from C library time_t type.
621 * @param time type to make date and time from.
622 */
623 DateTime(time_t time);
624
625 /**
626 * Construct a date and time from C library time structure.
627 * @param tm structure from C library (from glt or gmt).
628 */
629 DateTime(tm_t *tm);
630
631 /**
632 * Construct a date and time from ISO string buffer.
633 * @param pointer to string field holding date and time.
634 * @param size of field if not null terminated string.
635 */
636 DateTime(const char *pointer, size_t size = 0);
637
638 /**
639 * Construct a date and time object from explicit date and time values.
640 * @param year of object.
641 * @param month of object (1-12).
642 * @param day of month of object (1-31).
643 * @param hour of object (0-23).
644 * @param minute of object (0-59).
645 * @param second of object (0-59).
646 */
647 DateTime(int year, unsigned month, unsigned day,
648 int hour = 0, int minute = 0, int second = 0);
649
650 /**
651 * Create a datetime object from another object.
652 * @param object to copy.
653 */
654 DateTime(const DateTime& object);
655
656 /**
657 * Construct a new date and time object with current date and time.
658 */
659 DateTime();
660
661 /**
662 * Destroy date and time object.
663 */
664 virtual ~DateTime();
665
666 /**
667 * Get a ISO formatted date and time string for current object.
668 * @param buffer to store date and time in (yyyy-mm-dd hh:mm:ss).
669 * @return string buffer if object is valid.
670 */
671 const char *put(char *buffer) const;
672
673 /**
674 * Get C library time_t type if object in C library epoch range.
675 * @return time in seconds from epoch or ~0l if out of range.
676 */
677 time_t get(void) const;
678
679 /**
680 * Test if object is valid.
681 * @return true if object is valid.
682 */
683 bool is_valid(void) const;
684
685 /**
686 * Operator to compute number of days between two dates.
687 * @param datetime to offset from for computation.
688 * @return number of days difference.
689 */
690 long operator-(const DateTime &datetime);
691
692 /**
693 * Assign date and time from another datetime object.
694 * @param datetime object to assign from.
695 * @return assigned datetime object.
696 */
697 DateTime& operator=(const DateTime& datetime);
698
699 /**
700 * Add seconds to the current datetime object. Day overflows update
701 * julian date.
702 * @param seconds to add to object.
703 * @return modified datetime object.
704 */
705 DateTime& operator+=(long seconds);
706
707 /**
708 * Subtract seconds from current datetime object. Day underflows
709 * update julian date.
710 * @param seconds to subtract from object.
711 * @return modified datetime object.
712 */
713 DateTime& operator-=(long seconds);
714
715 /**
716 * Add seconds to datetime in an expression. Day overflows update
717 * julian date.
718 * @param seconds to add to datetime.
719 * @return new modified datetime object.
720 */
721 DateTime operator+(long seconds);
722
723 /**
724 * Subtract seconds from datetime in an expression. Day underflows
725 * update julian date.
726 * @param seconds to subtract from datetime.
727 * @return new modified datetime object.
728 */
729 DateTime operator-(long seconds);
730
731 /**
732 * Add a day from the current date and time.
733 * @return datetime object reference that was modified.
734 */
735 DateTime& operator++();
736
737 /**
738 * Subtract a day from the current date and time.
739 * @return datetime object reference that was modified.
740 */
741 DateTime& operator--();
742
743 /**
744 * Compare date and time with another date and time to see if the same.
745 * @param datetime to compare with.
746 * @return true if equal.
747 */
748 bool operator==(const DateTime& datetime) const;
749
750 /**
751 * Compare date and time with another date and time to see if not same.
752 * @param datetime to compare with.
753 * @return true if not equal.
754 */
755 bool operator!=(const DateTime& datetime) const;
756
757 /**
758 * Compare date and time with another date and time to see if earlier.
759 * @param datetime to compare with.
760 * @return true if earlier.
761 */
762 bool operator<(const DateTime& datetime) const;
763
764 /**
765 * Compare date and time with another date and time to see if earlier or
766 * the same.
767 * @param datetime to compare with.
768 * @return true if earlier or equal.
769 */
770 bool operator<=(const DateTime& datetime) const;
771
772 /**
773 * Compare date and time with another date and time to see if later.
774 * @param datetime to compare with.
775 * @return true if later.
776 */
777 bool operator>(const DateTime& datetime) const;
778
779 /**
780 * Compare date and time with another date and time to see if later or
781 * the same.
782 * @param datetime to compare with.
783 * @return true if later or equal.
784 */
785 bool operator>=(const DateTime& datetime) const;
786
787 /**
788 * Check if date and time is not valid.
789 * @return true if not valid.
790 */
791 bool operator!() const;
792
793 /**
794 * Test is date and time is valid for is() operator.
795 * @return true if object is valid.
796 */
797 operator bool() const;
798
799 /**
800 * Casting operator to return date as number.
801 * @return date as a number.
802 */
803 inline operator long() const
804 {return Date::get();};
805
806 /**
807 * Set (update) the date and time with current date and time.
808 */
809 void set(void);
810
811 /**
812 * Convert date and time to julian day number.
813 * @return julian day number as a double.
814 */
815 operator double() const;
816
817 /**
818 * Return date and time formatted using strftime format values.
819 * @param strftime format to use.
820 * @return String object with formatted time.
821 */
822 String format(const char *strftime) const;
823
824 /**
825 * Fetch an instance of time converted to local time. If the localtime
826 * abi is not re-entrant, than a lock is held, otherwise a unique
827 * object is returned. In either case, when you are done, you must
828 * release the object.
829 * @param time object or NULL if using current time.
830 * @return locked instance of struct tm object.
831 */
832 static tm_t *local(time_t *time = NULL);
833
834 /**
835 * Fetch an instance of time converted to gmt. If the gmtime abi
836 * is not re-entrant, than a lock is held, otherwise a unique
837 * object is returned. In either case, when you are done, you must
838 * release the object.
839 * @param time object or NULL if using current time.
840 * @return locked instance of struct tm object.
841 */
842 static tm_t *gmt(time_t *time = NULL);
843
844 /**
845 * Release a struct tm object from glt or gmt.
846 * @param object to release.
847 */
848 static void release(tm_t *object);
849};
850
851/**
852 * A DateTime string class. This can be used to access the date and time
853 * as a standard string without requiring an external buffer.
854 *
855 * @author David Sugar <dyfet@gnutelephony.org>
856 * @short a datetime class that returns strings.
857 */
858class __EXPORT DateTimeString : public DateTime
859{
860public:
861 /**
862 * Specify string buffer mode. By default we form a string with date
863 * and time.
864 */
865 typedef enum {
866 DATE, TIME, BOTH} mode_t;
867
868private:
869 char buffer[DATETIME_BUFFER_SIZE];
870 mode_t mode;
871
872protected:
873 void update(void);
874
875public:
876 /**
877 * Construct a date and time from C libraray time_t type.
878 * @param time type to make date and time from.
879 */
880 DateTimeString(time_t time);
881
882 /**
883 * Construct a date and time from C library time structure.
884 * @param tm structure from C library (from glt or gmt).
885 */
886 DateTimeString(tm_t *tm);
887
888 /**
889 * Construct a date and time from ISO string buffer.
890 * @param pointer to string field holding date and time.
891 * @param size of field if not null terminated string.
892 */
893 DateTimeString(const char *pointer, size_t size = 0);
894
895 /**
896 * Construct a date and time object from explicit date and time values.
897 * @param year of object.
898 * @param month of object (1-12).
899 * @param day of month of object (1-31).
900 * @param hour of object (0-23).
901 * @param minute of object (0-59).
902 * @param second of object (0-59).
903 */
904 DateTimeString(int year, unsigned month, unsigned day,
905 int hour = 0, int minute = 0, int second = 0);
906
907 /**
908 * Create a datetime object from another object.
909 * @param object to copy.
910 */
911 DateTimeString(const DateTimeString& object);
912
913 /**
914 * Construct a new date and time object with current date and time.
915 */
916 DateTimeString(mode_t string = DateTimeString::BOTH);
917
918 /**
919 * Destroy date time string.
920 */
921 virtual ~DateTimeString();
922
923 /**
924 * Extract char from string.
925 *
926 * @return string of datetime.
927 */
928 inline const char *c_str(void)
929 {return buffer;};
930
931 /**
932 * Cast to string.
933 *
934 * @return string of datetime.
935 */
936 inline operator const char *(void)
937 {return buffer;};
938
939 /**
940 * Set (update) the date and time with current date and time.
941 */
942 void set(void);
943
944 /**
945 * Set the string mode.
946 * @param string mode to use.
947 */
948 void set(mode_t string);
949};
950
951/**
952 * A number class that manipulates a string buffer that is also a date.
953 *
954 * @author David Sugar <dyfet@ostel.com>
955 * @short a number that is also a date string.
956 */
957class __EXPORT DateNumber : public Number, public Date
958{
959protected:
960 void update(void);
961
962public:
963 /**
964 * Create a date number tied to a refreshed string buffer.
965 * @param pointer to string buffer to rewrite.
966 */
967 DateNumber(char *pointer);
968
969 /**
970 * Release a datenumber object.
971 */
972 virtual ~DateNumber();
973
974 /**
975 * Set date number to current date.
976 */
977 void set(void);
978};
979
980class __EXPORT isotime : public PrintProtocol, public InputProtocol
981{
982private:
983 Date *d;
984 Time *t;
985
986 enum {DATE, TIME, DATETIME} mode;
987 char buf[32];
988 unsigned pos;
989
990protected:
991 const char *_print(void) const;
992
993 int _input(int code);
994
995public:
996 isotime(Date& date, Time& time);
997 isotime(Date& date);
998 isotime(Time& time);
999};
1000
1001/**
1002 * Convenience type for using DateTime object.
1003 */
1004typedef DateTime datetime_t;
1005
1006/**
1007 * Convenience type for using DateTimeString object.
1008 */
1009typedef DateTimeString datetimestring_t;
1010
1011/**
1012 * Convenience type for using Date object.
1013 */
1014typedef Date date_t;
1015
1016/**
1017 * Convenience type for using Time object.
1018 */
1019typedef Time tod_t;
1020
1021extern "C" {
1022 __EXPORT long tzoffset(struct timezone *tz = NULL);
1023}
1024
1025END_NAMESPACE
1026
1027#endif