| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999-2000 Harri Porten (porten@kde.org) | 2 * Copyright (C) 1999-2000 Harri Porten (porten@kde.org) |
| 3 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. | 3 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. |
| 4 * Copyright (C) 2009 Google Inc. All rights reserved. | 4 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 5 * Copyright (C) 2007-2009 Torch Mobile, Inc. | 5 * Copyright (C) 2007-2009 Torch Mobile, Inc. |
| 6 * Copyright (C) 2010 &yet, LLC. (nate@andyet.net) | 6 * Copyright (C) 2010 &yet, LLC. (nate@andyet.net) |
| 7 * | 7 * |
| 8 * The Original Code is Mozilla Communicator client code, released | 8 * The Original Code is Mozilla Communicator client code, released |
| 9 * March 31, 1998. | 9 * March 31, 1998. |
| 10 * | 10 * |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 64 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 65 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 65 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 66 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 66 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 67 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 67 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 68 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 68 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 69 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 69 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 70 */ | 70 */ |
| 71 | 71 |
| 72 #include "platform/wtf/DateMath.h" | 72 #include "platform/wtf/DateMath.h" |
| 73 | 73 |
| 74 #include <limits.h> |
| 75 #include <math.h> |
| 76 #include <stdlib.h> |
| 77 #include <time.h> |
| 78 #include <algorithm> |
| 79 #include <limits> |
| 74 #include "platform/wtf/ASCIICType.h" | 80 #include "platform/wtf/ASCIICType.h" |
| 75 #include "platform/wtf/Assertions.h" | 81 #include "platform/wtf/Assertions.h" |
| 76 #include "platform/wtf/CurrentTime.h" | 82 #include "platform/wtf/CurrentTime.h" |
| 77 #include "platform/wtf/MathExtras.h" | 83 #include "platform/wtf/MathExtras.h" |
| 78 #include "platform/wtf/StdLibExtras.h" | 84 #include "platform/wtf/StdLibExtras.h" |
| 79 #include "platform/wtf/StringExtras.h" | 85 #include "platform/wtf/StringExtras.h" |
| 80 #include "platform/wtf/text/StringBuilder.h" | 86 #include "platform/wtf/text/StringBuilder.h" |
| 81 #include <algorithm> | |
| 82 #include <limits.h> | |
| 83 #include <limits> | |
| 84 #include <math.h> | |
| 85 #include <stdlib.h> | |
| 86 #include <time.h> | |
| 87 | 87 |
| 88 #if OS(WIN) | 88 #if OS(WIN) |
| 89 #include <windows.h> | 89 #include <windows.h> |
| 90 #else | 90 #else |
| 91 #include <sys/time.h> | 91 #include <sys/time.h> |
| 92 #endif | 92 #endif |
| 93 | 93 |
| 94 namespace WTF { | 94 namespace WTF { |
| 95 | 95 |
| 96 /* Constants */ | 96 /* Constants */ |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 731 if (o < -9959 || o > 9959) | 731 if (o < -9959 || o > 9959) |
| 732 return std::numeric_limits<double>::quiet_NaN(); | 732 return std::numeric_limits<double>::quiet_NaN(); |
| 733 | 733 |
| 734 int sgn = (o < 0) ? -1 : 1; | 734 int sgn = (o < 0) ? -1 : 1; |
| 735 o = abs(o); | 735 o = abs(o); |
| 736 if (*date_string != ':') { | 736 if (*date_string != ':') { |
| 737 if (o >= 24) | 737 if (o >= 24) |
| 738 offset = ((o / 100) * 60 + (o % 100)) * sgn; | 738 offset = ((o / 100) * 60 + (o % 100)) * sgn; |
| 739 else | 739 else |
| 740 offset = o * 60 * sgn; | 740 offset = o * 60 * sgn; |
| 741 } else { // GMT+05:00 | 741 } else { // GMT+05:00 |
| 742 ++date_string; // skip the ':' | 742 ++date_string; // skip the ':' |
| 743 int o2; | 743 int o2; |
| 744 if (!ParseInt(date_string, &new_pos_str, 10, &o2)) | 744 if (!ParseInt(date_string, &new_pos_str, 10, &o2)) |
| 745 return std::numeric_limits<double>::quiet_NaN(); | 745 return std::numeric_limits<double>::quiet_NaN(); |
| 746 date_string = new_pos_str; | 746 date_string = new_pos_str; |
| 747 offset = (o * 60 + o2) * sgn; | 747 offset = (o * 60 + o2) * sgn; |
| 748 } | 748 } |
| 749 have_tz = true; | 749 have_tz = true; |
| 750 } else { | 750 } else { |
| 751 for (size_t i = 0; i < WTF_ARRAY_LENGTH(known_zones); ++i) { | 751 for (size_t i = 0; i < WTF_ARRAY_LENGTH(known_zones); ++i) { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 836 return string_builder.ToString(); | 836 return string_builder.ToString(); |
| 837 } | 837 } |
| 838 | 838 |
| 839 double ConvertToLocalTime(double ms) { | 839 double ConvertToLocalTime(double ms) { |
| 840 double utc_offset = CalculateUTCOffset(); | 840 double utc_offset = CalculateUTCOffset(); |
| 841 double dst_offset = CalculateDSTOffset(ms, utc_offset); | 841 double dst_offset = CalculateDSTOffset(ms, utc_offset); |
| 842 return (ms + utc_offset + dst_offset); | 842 return (ms + utc_offset + dst_offset); |
| 843 } | 843 } |
| 844 | 844 |
| 845 } // namespace WTF | 845 } // namespace WTF |
| OLD | NEW |