Debian Codegraph @

src/3rdparty/javascriptcore/JavaScriptCore/runtime/DateConversion.cpp

raw symbols SCIP
1 /*
2 * Copyright (C) 1999-2000 Harri Porten ([email protected])
3 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
4 * Copyright (C) 2009 Google Inc. All rights reserved.
5 *
6 * The Original Code is Mozilla Communicator client code, released
7 * March 31, 1998.
8 *
9 * The Initial Developer of the Original Code is
10 * Netscape Communications Corporation.
11 * Portions created by the Initial Developer are Copyright (C) 1998
12 * the Initial Developer. All Rights Reserved.
13 *
14 * This library is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Lesser General Public
16 * License as published by the Free Software Foundation; either
17 * version 2.1 of the License, or (at your option) any later version.
18 *
19 * This library is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Lesser General Public License for more details.
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with this library; if not, write to the Free Software
26 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
27 *
28 * Alternatively, the contents of this file may be used under the terms
29 * of either the Mozilla Public License Version 1.1, found at
30 * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public
31 * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html
32 * (the "GPL"), in which case the provisions of the MPL or the GPL are
33 * applicable instead of those above. If you wish to allow use of your
34 * version of this file only under the terms of one of those two
35 * licenses (the MPL or the GPL) and not to allow others to use your
36 * version of this file under the LGPL, indicate your decision by
37 * deletingthe provisions above and replace them with the notice and
38 * other provisions required by the MPL or the GPL, as the case may be.
39 * If you do not delete the provisions above, a recipient may use your
40 * version of this file under any of the LGPL, the MPL or the GPL.
41 */
42
43 #include "config.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/config.h`/
44 #include "DateConversion.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/DateConversion.h`/
45
46 #include "CallFrame.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/interpreter/CallFrame.h`/
47 #include "UString.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/UString.h`/
48 #include <wtf/DateMath.h>cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/DateMath.h`/
49 #include <wtf/StringExtras.h>cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/StringExtras.h`/
50
51 #if OScxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:49:9`!(WINDOWS)
52 #include <windows.h>
53 #endif
54
55 using namespace WTFcxx . . $ `<built-in>:467:9`!;
56
57 namespace JSCcxx . . $ `<built-in>:463:9`! {
58
59 double parseDatecxx . . $ QTJSC/parseDate(c3266bca1a95c47c).(ExecStatecxx . . $ QTJSC/ExecState#* exec, const UStringcxx . . $ QTJSC/UString# &date)
60 {
61 if (date ==cxx . . $ QTJSC/`operator==`(e9142ab59ce7dac8). exec->globalDatacxx . . $ QTJSC/ExecState#globalData(ae00a65ac2fd4a61).().cachedDateString)
62 return exec->globalDatacxx . . $ QTJSC/ExecState#globalData(ae00a65ac2fd4a61).().cachedDateStringValuecxx . . $ QTJSC/JSGlobalData#cachedDateStringValue.;
63 double value = parseDateFromNullTerminatedCharacterscxx . . $ QTJSC/parseDateFromNullTerminatedCharacters(e1ee60001899bbeb).(exec, date.UTF8Stringcxx . . $ QTJSC/UString#UTF8String(93ff631091aac352).().c_strcxx . . $ QTJSC/CString#c_str(a9f41ea0e82d88cf).());
64 exec->globalDatacxx . . $ QTJSC/ExecState#globalData(ae00a65ac2fd4a61).().cachedDateString = date;
65 exec->globalDatacxx . . $ QTJSC/ExecState#globalData(ae00a65ac2fd4a61).().cachedDateStringValuecxx . . $ QTJSC/JSGlobalData#cachedDateStringValue. = value;
66 return value;
67 }
68
69 void formatDatecxx . . $ QTJSC/formatDate(e27d52a808d9d4cd).(const GregorianDateTimecxx . . $ QTJSC/GregorianDateTime# &t, DateConversionBuffercxx . . $ QTJSC/DateConversionBuffer#& buffer)
70 {
71 snprintf(buffer, DateConversionBufferSizecxx . . $ QTJSC/DateConversionBufferSize., "%s %s %02d %04d",
72 weekdayNamecxx . . $ QTWTF/weekdayName.[(t.weekDaycxx . . $ QTJSC/GregorianDateTime#weekDay. + 6) % 7],
73 monthNamecxx . . $ QTWTF/monthName.[t.monthcxx . . $ QTJSC/GregorianDateTime#month.], t.monthDaycxx . . $ QTJSC/GregorianDateTime#monthDay., t.yearcxx . . $ QTJSC/GregorianDateTime#year. + 1900);
74 }
75
76 void formatDateUTCVariantcxx . . $ QTJSC/formatDateUTCVariant(e27d52a808d9d4cd).(const GregorianDateTimecxx . . $ QTJSC/GregorianDateTime# &t, DateConversionBuffercxx . . $ QTJSC/DateConversionBuffer#& buffer)
77 {
78 snprintf(buffer, DateConversionBufferSizecxx . . $ QTJSC/DateConversionBufferSize., "%s, %02d %s %04d",
79 weekdayNamecxx . . $ QTWTF/weekdayName.[(t.weekDaycxx . . $ QTJSC/GregorianDateTime#weekDay. + 6) % 7],
80 t.monthDaycxx . . $ QTJSC/GregorianDateTime#monthDay., monthNamecxx . . $ QTWTF/monthName.[t.monthcxx . . $ QTJSC/GregorianDateTime#month.], t.yearcxx . . $ QTJSC/GregorianDateTime#year. + 1900);
81 }
82
83 void formatTimecxx . . $ QTJSC/formatTime(e27d52a808d9d4cd).(const GregorianDateTimecxx . . $ QTJSC/GregorianDateTime# &t, DateConversionBuffercxx . . $ QTJSC/DateConversionBuffer#& buffer)
84 {
85 int offset = abscxx . . $ abs(7864480464b09eea).(gmtoffsetcxx . . $ QTJSC/gmtoffset(707d7e193f3ddb28).(t));
86 #if OScxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:49:9`!(WINDOWS)
87 TIME_ZONE_INFORMATION timeZoneInformation;
88 GetTimeZoneInformation(&timeZoneInformation);
89 const WCHAR* timeZoneName = t.isDST ? timeZoneInformation.DaylightName : timeZoneInformation.StandardName;
90 #else
91 char timeZoneName[70];
92 struct tmcxx . . $ tm# gtm = t;
93 strftime(timeZoneName, sizeof(timeZoneName), "%Z", &gtm);
94 #endif
95
96 if (timeZoneName[0]) {
97 #if OScxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:49:9`!(WINDOWS)
98 snprintf(buffer, DateConversionBufferSize, "%02d:%02d:%02d GMT%c%02d%02d (%S)",
99 #else
100 snprintf(buffer, DateConversionBufferSizecxx . . $ QTJSC/DateConversionBufferSize., "%02d:%02d:%02d GMT%c%02d%02d (%s)",
101 #endif
102 t.hourcxx . . $ QTJSC/GregorianDateTime#hour., t.minutecxx . . $ QTJSC/GregorianDateTime#minute., t.secondcxx . . $ QTJSC/GregorianDateTime#second.,
103 gmtoffsetcxx . . $ QTJSC/gmtoffset(707d7e193f3ddb28).(t) < 0 ? '-' : '+', offset / (60*60), (offset / 60) % 60, timeZoneName);
104 } else {
105 snprintf(buffer, DateConversionBufferSizecxx . . $ QTJSC/DateConversionBufferSize., "%02d:%02d:%02d GMT%c%02d%02d",
106 t.hourcxx . . $ QTJSC/GregorianDateTime#hour., t.minutecxx . . $ QTJSC/GregorianDateTime#minute., t.secondcxx . . $ QTJSC/GregorianDateTime#second.,
107 gmtoffsetcxx . . $ QTJSC/gmtoffset(707d7e193f3ddb28).(t) < 0 ? '-' : '+', offset / (60*60), (offset / 60) % 60);
108 }
109 }
110
111 void formatTimeUTCcxx . . $ QTJSC/formatTimeUTC(e27d52a808d9d4cd).(const GregorianDateTimecxx . . $ QTJSC/GregorianDateTime# &t, DateConversionBuffercxx . . $ QTJSC/DateConversionBuffer#& buffer)
112 {
113 snprintf(buffer, DateConversionBufferSizecxx . . $ QTJSC/DateConversionBufferSize., "%02d:%02d:%02d GMT", t.hourcxx . . $ QTJSC/GregorianDateTime#hour., t.minutecxx . . $ QTJSC/GregorianDateTime#minute., t.secondcxx . . $ QTJSC/GregorianDateTime#second.);
114 }
115
116 } // namespace JSC