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

Side by Side Diff: third_party/WebKit/Source/wtf/DateMath.h

Issue 2774333002: Revert "Move files in wtf/ to platform/wtf/" (Closed)
Patch Set: Created 3 years, 8 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 /*
2 // Use of this source code is governed by a BSD-style license that can be 2 * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
3 // found in the LICENSE file. 3 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
4 * Copyright (C) 2009 Google Inc. All rights reserved.
5 * Copyright (C) 2010 Research In Motion Limited. All rights reserved.
6 *
7 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
8 *
9 * The contents of this file are subject to the Mozilla Public License Version
10 * 1.1 (the "License"); you may not use this file except in compliance with
11 * the License. You may obtain a copy of the License at
12 * http://www.mozilla.org/MPL/
13 *
14 * Software distributed under the License is distributed on an "AS IS" basis,
15 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
16 * for the specific language governing rights and limitations under the
17 * License.
18 *
19 * The Original Code is Mozilla Communicator client code, released
20 * March 31, 1998.
21 *
22 * The Initial Developer of the Original Code is
23 * Netscape Communications Corporation.
24 * Portions created by the Initial Developer are Copyright (C) 1998
25 * the Initial Developer. All Rights Reserved.
26 *
27 * Contributor(s):
28 *
29 * Alternatively, the contents of this file may be used under the terms of
30 * either of the GNU General Public License Version 2 or later (the "GPL"),
31 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
32 * in which case the provisions of the GPL or the LGPL are applicable instead
33 * of those above. If you wish to allow use of your version of this file only
34 * under the terms of either the GPL or the LGPL, and not to allow others to
35 * use your version of this file under the terms of the MPL, indicate your
36 * decision by deleting the provisions above and replace them with the notice
37 * and other provisions required by the GPL or the LGPL. If you do not delete
38 * the provisions above, a recipient may use your version of this file under
39 * the terms of any one of the MPL, the GPL or the LGPL.
40 *
41 */
4 42
5 #include "platform/wtf/DateMath.h" 43 #ifndef DateMath_h
44 #define DateMath_h
6 45
7 // The contents of this header was moved to platform/wtf as part of 46 #include "wtf/WTFExport.h"
8 // WTF migration project. See the following post for details: 47 #include "wtf/text/WTFString.h"
9 // https://groups.google.com/a/chromium.org/d/msg/blink-dev/tLdAZCTlcAA/bYXVT8gY CAAJ 48 #include <stdint.h>
49 #include <string.h>
50
51 namespace WTF {
52
53 WTF_EXPORT void initializeDates();
54
55 // Not really math related, but this is currently the only shared place to put
56 // these.
57 WTF_EXPORT double parseDateFromNullTerminatedCharacters(const char* dateString);
58 // dayOfWeek: [0, 6] 0 being Monday
59 // day: [1, 31]
60 // month: [0, 11]
61 // year: ex: 2011
62 // hours: [0, 23]
63 // minutes: [0, 59]
64 // seconds: [0, 59]
65 // utcOffset: [-720,720].
66 WTF_EXPORT String makeRFC2822DateString(unsigned dayOfWeek,
67 unsigned day,
68 unsigned month,
69 unsigned year,
70 unsigned hours,
71 unsigned minutes,
72 unsigned seconds,
73 int utcOffset);
74
75 const char weekdayName[7][4] = {"Mon", "Tue", "Wed", "Thu",
76 "Fri", "Sat", "Sun"};
77 const char monthName[12][4] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
78 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
79 const char* const monthFullName[12] = {
80 "January", "February", "March", "April", "May", "June",
81 "July", "August", "September", "October", "November", "December"};
82
83 const double minutesPerHour = 60.0;
84 const double secondsPerMinute = 60.0;
85 const double msPerSecond = 1000.0;
86 const double msPerMinute = 60.0 * 1000.0;
87 const double msPerHour = 60.0 * 60.0 * 1000.0;
88 const double msPerDay = 24.0 * 60.0 * 60.0 * 1000.0;
89
90 WTF_EXPORT bool isLeapYear(int year);
91
92 // Returns the number of days from 1970-01-01 to the specified date.
93 WTF_EXPORT double dateToDaysFrom1970(int year, int month, int day);
94 WTF_EXPORT int msToYear(double ms);
95 WTF_EXPORT int dayInYear(int year, int month, int day);
96 WTF_EXPORT int dayInYear(double ms, int year);
97 WTF_EXPORT int monthFromDayInYear(int dayInYear, bool leapYear);
98 WTF_EXPORT int dayInMonthFromDayInYear(int dayInYear, bool leapYear);
99
100 // Returns milliseconds with UTC and DST.
101 WTF_EXPORT double convertToLocalTime(double ms);
102
103 } // namespace WTF
104
105 using WTF::isLeapYear;
106 using WTF::dateToDaysFrom1970;
107 using WTF::dayInMonthFromDayInYear;
108 using WTF::dayInYear;
109 using WTF::minutesPerHour;
110 using WTF::monthFromDayInYear;
111 using WTF::msPerDay;
112 using WTF::msPerHour;
113 using WTF::msPerMinute;
114 using WTF::msPerSecond;
115 using WTF::msToYear;
116 using WTF::secondsPerMinute;
117 using WTF::parseDateFromNullTerminatedCharacters;
118 using WTF::makeRFC2822DateString;
119 using WTF::convertToLocalTime;
120
121 #endif // DateMath_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/CONTRIBUTORS.pthreads-win32 ('k') | third_party/WebKit/Source/wtf/DateMath.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698