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 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 bool haveTZ; | 788 bool haveTZ; |
789 int offset; | 789 int offset; |
790 double ms = parseDateFromNullTerminatedCharacters(dateString, haveTZ, offset
); | 790 double ms = parseDateFromNullTerminatedCharacters(dateString, haveTZ, offset
); |
791 if (std::isnan(ms)) | 791 if (std::isnan(ms)) |
792 return std::numeric_limits<double>::quiet_NaN(); | 792 return std::numeric_limits<double>::quiet_NaN(); |
793 | 793 |
794 // fall back to local timezone | 794 // fall back to local timezone |
795 if (!haveTZ) { | 795 if (!haveTZ) { |
796 double utcOffset = calculateUTCOffset(); | 796 double utcOffset = calculateUTCOffset(); |
797 double dstOffset = calculateDSTOffset(ms, utcOffset); | 797 double dstOffset = calculateDSTOffset(ms, utcOffset); |
798 offset = (utcOffset + dstOffset) / msPerMinute; | 798 offset = static_cast<int>((utcOffset + dstOffset) / msPerMinute); |
799 } | 799 } |
800 return ms - (offset * msPerMinute); | 800 return ms - (offset * msPerMinute); |
801 } | 801 } |
802 | 802 |
803 // See http://tools.ietf.org/html/rfc2822#section-3.3 for more information. | 803 // See http://tools.ietf.org/html/rfc2822#section-3.3 for more information. |
804 String makeRFC2822DateString(unsigned dayOfWeek, unsigned day, unsigned month, u
nsigned year, unsigned hours, unsigned minutes, unsigned seconds, int utcOffset) | 804 String makeRFC2822DateString(unsigned dayOfWeek, unsigned day, unsigned month, u
nsigned year, unsigned hours, unsigned minutes, unsigned seconds, int utcOffset) |
805 { | 805 { |
806 StringBuilder stringBuilder; | 806 StringBuilder stringBuilder; |
807 stringBuilder.append(weekdayName[dayOfWeek]); | 807 stringBuilder.append(weekdayName[dayOfWeek]); |
808 stringBuilder.appendLiteral(", "); | 808 stringBuilder.appendLiteral(", "); |
(...skipping 20 matching lines...) Expand all Loading... |
829 } | 829 } |
830 | 830 |
831 double convertToLocalTime(double ms) | 831 double convertToLocalTime(double ms) |
832 { | 832 { |
833 double utcOffset = calculateUTCOffset(); | 833 double utcOffset = calculateUTCOffset(); |
834 double dstOffset = calculateDSTOffset(ms, utcOffset); | 834 double dstOffset = calculateDSTOffset(ms, utcOffset); |
835 return (ms + utcOffset + dstOffset); | 835 return (ms + utcOffset + dstOffset); |
836 } | 836 } |
837 | 837 |
838 } // namespace WTF | 838 } // namespace WTF |
OLD | NEW |