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

Side by Side Diff: Source/platform/DateComponents.cpp

Issue 288733002: Kill WTF::GregorianDateTime class (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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/platform/DateComponents.h ('k') | Source/platform/mhtml/MHTMLArchive.cpp » ('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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 } 74 }
75 // 4:March, ..., 14:January, 15:February 75 // 4:March, ..., 14:January, 15:February
76 76
77 int highYear = year / 100; 77 int highYear = year / 100;
78 int lowYear = year % 100; 78 int lowYear = year % 100;
79 // We add 6 to make the result Sunday-origin. 79 // We add 6 to make the result Sunday-origin.
80 int result = (day + 13 * shiftedMonth / 5 + lowYear + lowYear / 4 + highYear / 4 + 5 * highYear + 6) % 7; 80 int result = (day + 13 * shiftedMonth / 5 + lowYear + lowYear / 4 + highYear / 4 + 5 * highYear + 6) % 7;
81 return result; 81 return result;
82 } 82 }
83 83
84 int DateComponents::weekDay() const
85 {
86 return dayOfWeek(m_year, m_month, m_monthDay);
87 }
88
84 int DateComponents::maxWeekNumberInYear() const 89 int DateComponents::maxWeekNumberInYear() const
85 { 90 {
86 int day = dayOfWeek(m_year, 0, 1); // January 1. 91 int day = dayOfWeek(m_year, 0, 1); // January 1.
87 return day == Thursday || (day == Wednesday && isLeapYear(m_year)) ? maximum WeekNumber : maximumWeekNumber - 1; 92 return day == Thursday || (day == Wednesday && isLeapYear(m_year)) ? maximum WeekNumber : maximumWeekNumber - 1;
88 } 93 }
89 94
90 static unsigned countDigits(const String& src, unsigned start) 95 static unsigned countDigits(const String& src, unsigned start)
91 { 96 {
92 unsigned index = start; 97 unsigned index = start;
93 for (; index < src.length(); ++index) { 98 for (; index < src.length(); ++index) {
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 case Week: 708 case Week:
704 return String::format("%04d-W%02d", m_year, m_week); 709 return String::format("%04d-W%02d", m_year, m_week);
705 case Invalid: 710 case Invalid:
706 break; 711 break;
707 } 712 }
708 ASSERT_NOT_REACHED(); 713 ASSERT_NOT_REACHED();
709 return String("(Invalid DateComponents)"); 714 return String("(Invalid DateComponents)");
710 } 715 }
711 716
712 } // namespace WebCore 717 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/platform/DateComponents.h ('k') | Source/platform/mhtml/MHTMLArchive.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698