| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Patrick Gansterer <paroga@paroga.com> | 2 * Copyright (C) 2012 Patrick Gansterer <paroga@paroga.com> |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| 11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
| 12 * | 12 * |
| 13 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY | 13 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY |
| 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 16 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY | 16 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY |
| 17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 20 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 20 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 23 */ | 23 */ |
| 24 | 24 |
| 25 #ifndef WTF_GregorianDateTime_h | 25 #ifndef WTF_GregorianDateTime_h |
| 26 #define WTF_GregorianDateTime_h | 26 #define WTF_GregorianDateTime_h |
| 27 | 27 |
| 28 #include <string.h> | 28 #include <string.h> |
| 29 #include <time.h> | 29 #include <time.h> |
| 30 #include <wtf/Noncopyable.h> | 30 #include "wtf/Noncopyable.h" |
| 31 #include "wtf/WTFExport.h" |
| 31 | 32 |
| 32 namespace WTF { | 33 namespace WTF { |
| 33 | 34 |
| 34 class GregorianDateTime { | 35 class GregorianDateTime { |
| 35 WTF_MAKE_NONCOPYABLE(GregorianDateTime); | 36 WTF_MAKE_NONCOPYABLE(GregorianDateTime); |
| 36 public: | 37 public: |
| 37 GregorianDateTime() | 38 GregorianDateTime() |
| 38 : m_year(0) | 39 : m_year(0) |
| 39 , m_month(0) | 40 , m_month(0) |
| 40 , m_yearDay(0) | 41 , m_yearDay(0) |
| (...skipping 22 matching lines...) Expand all Loading... |
| 63 inline void setMonth(int month) { m_month = month; } | 64 inline void setMonth(int month) { m_month = month; } |
| 64 inline void setYearDay(int yearDay) { m_yearDay = yearDay; } | 65 inline void setYearDay(int yearDay) { m_yearDay = yearDay; } |
| 65 inline void setMonthDay(int monthDay) { m_monthDay = monthDay; } | 66 inline void setMonthDay(int monthDay) { m_monthDay = monthDay; } |
| 66 inline void setWeekDay(int weekDay) { m_weekDay = weekDay; } | 67 inline void setWeekDay(int weekDay) { m_weekDay = weekDay; } |
| 67 inline void setHour(int hour) { m_hour = hour; } | 68 inline void setHour(int hour) { m_hour = hour; } |
| 68 inline void setMinute(int minute) { m_minute = minute; } | 69 inline void setMinute(int minute) { m_minute = minute; } |
| 69 inline void setSecond(int second) { m_second = second; } | 70 inline void setSecond(int second) { m_second = second; } |
| 70 inline void setUtcOffset(int utcOffset) { m_utcOffset = utcOffset; } | 71 inline void setUtcOffset(int utcOffset) { m_utcOffset = utcOffset; } |
| 71 inline void setIsDST(int isDST) { m_isDST = isDST; } | 72 inline void setIsDST(int isDST) { m_isDST = isDST; } |
| 72 | 73 |
| 73 void setToCurrentLocalTime(); | 74 WTF_EXPORT void setToCurrentLocalTime(); |
| 74 | 75 |
| 75 operator tm() const | 76 operator tm() const |
| 76 { | 77 { |
| 77 tm ret; | 78 tm ret; |
| 78 memset(&ret, 0, sizeof(ret)); | 79 memset(&ret, 0, sizeof(ret)); |
| 79 | 80 |
| 80 ret.tm_year = m_year - 1900; | 81 ret.tm_year = m_year - 1900; |
| 81 ret.tm_mon = m_month; | 82 ret.tm_mon = m_month; |
| 82 ret.tm_yday = m_yearDay; | 83 ret.tm_yday = m_yearDay; |
| 83 ret.tm_mday = m_monthDay; | 84 ret.tm_mday = m_monthDay; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 int m_second; | 120 int m_second; |
| 120 int m_utcOffset; | 121 int m_utcOffset; |
| 121 int m_isDST; | 122 int m_isDST; |
| 122 }; | 123 }; |
| 123 | 124 |
| 124 } // namespace WTF | 125 } // namespace WTF |
| 125 | 126 |
| 126 using WTF::GregorianDateTime; | 127 using WTF::GregorianDateTime; |
| 127 | 128 |
| 128 #endif // WTF_GregorianDateTime_h | 129 #endif // WTF_GregorianDateTime_h |
| OLD | NEW |