Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(788)

Side by Side Diff: Source/wtf/DateMath.cpp

Issue 641643004: Reapply the non-MathExtras parts of (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/wtf/CryptographicallyRandomNumber.cpp ('k') | Source/wtf/PartitionAlloc.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « Source/wtf/CryptographicallyRandomNumber.cpp ('k') | Source/wtf/PartitionAlloc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698